我想我的<div id="container">
位於導航菜單的右側,但我遇到了問題。css造型和對齊問題
任何人都可以請幫我解決這個問題。
的index.php
<!-- This is the page identifier. Change on each of your pages! -->
<?php $page ='page_index'; ?>
<!doctype html>
<head>
<meta charset="UTF-8">
<title>Index</title>
<meta name="description" content="Example of PHP include active navigation">
<link rel="stylesheet" href="style.css">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="container">
<header>
<h1>Index page</h1>
</header>
<!-- This is where we want to include the nav.php file! -->
<?php include("nav.php"); ?>
<div id="main" role="main">
<p>This is the index page</p>
</div>
<footer>
<p>This is the footer</p>
</footer>
</div>
</body>
</html>
nav.php
<nav role="navigation" id="<?php echo $page ?>">
<ul>
<li><a class="index" href="index.php">Home</a></li>
<li><a class="about" href="about.php">About</a></li>
<li><a class="contact" href="contact.php">Contact</a></li>
</ul>
</nav>
的style.css
nav ul {
list-style: none;
display:inline-block;
float:left;
}
ul a {
color:green;
}
nav#page_index ul li a.index,
nav#page_about ul li a.about,
nav#page_contact ul li a.contact {
color:red;
}
這是我加入到周的style.css
div.container
{
float:left;
}
請讓我知道我可以做左側導航菜單有一些漂亮的格式。
在此先感謝..!
根據你的代碼你必須設置'ul'和'container'的寬度 –