0
我試過包括兩個引導菜單,一個垂直和一個水平的在我的網頁,但佈局被破壞。有沒有解決方案? 這是我的水平菜單代碼:水平和垂直自舉導航欄不能正常工作
<html lang="en"><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Bootstrap core CSS -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="home.php">Company</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="home.php"><i class="glyphicon glyphicon-home"></i><span> Home</span></a></li>
<li><a href="order.php"><i class="glyphicon glyphicon-pencil"></i><span> Order</span></a></li>
<li><a href="cart.php"><i class="glyphicon glyphicon-shopping-cart"></i><span> Cart</span></a></li>
<li><a href="contactus.php"><i class="glyphicon glyphicon-earphone"></i><span> Contact Us</span></a></li>
<li><a href="about.php"><i class="glyphicon glyphicon-search"></i><span> About Us</span></a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="register.php"><i class="glyphicon glyphicon-registration-mark"></i><span> Register</span></a></li>
<li class="active"><a href="login.php"><i class="glyphicon glyphicon-user"></i><span> Login</span></a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
,這是我的垂直菜單代碼。
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="generator" content="Bootply">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- CSS code from Bootply.com editor -->
<style type="text/css">
@media (min-width: 768px) {
.navbar-collapse {
height: auto;
border-top: 0;
box-shadow: none;
max-height: none;
padding-left:0;
padding-right:0;
}
.navbar-collapse.collapse {
display: block !important;
width: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.navbar-collapse.in {
overflow-x: visible;
}
.navbar
{
max-width:200px;
margin-right: 0;
margin-left: 0;
margin-top:200px;
}
.navbar-nav,
.navbar-nav > li,
.navbar-left,
.navbar-right,
.navbar-header
{float:none !important;}
.navbar-right .dropdown-menu {left:0;right:auto;}
.navbar-collapse .navbar-nav.navbar-right:last-child {
margin-right: 0;
margin-top:200;
}
}
</style>
</head>
<!-- HTML code from Bootply.com editor -->
<body>
<nav class="navbar navbar-default" role="navigation">
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="breads.php">Breads</a></li>
<li><a href="cupcakes.php">Cupcakes</a></li>
<li><a href="pies.php">Pies</a></li>
<li><a href="pastas.php">Pastas</a></li>
<li><a href="desserts.php">Desserts</a></li>
<li><a href="caters.php">Caters</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>
</body></html>
然後我想在這裏包括它。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Categories - Breads</title>
</head>
<body>
<?php include_once("hor_menu.php");?>
<?php include_once("vert_menu.php");?>
</body>
</html>
是否可以在不破壞佈局的情況下包含這兩個文件?
你需要,如果你想幫助 – Jonathon
@Jonathon我包括代碼發佈您的代碼。謝謝。 – user1023
你有2個單獨的完整的HTML文件,你試圖將它們都包含在另一個HTML文件中?他們都是基本上單獨的頁面,他們不應該像那樣 – Jonathon