我只是回到網站的工作,並不能爲我的生活中心此導航欄。我將標題向左移動,並感覺我已經嘗試了每個可能的屬性,但它不會居中。任何幫助將非常感激。標題和導航欄對齊
.container {
margin: 0 auto;
background-color: #fff;
}
.header-heading {
float: left;
padding-top: 8px;
padding-left: 5px;
color: #ddd;
font-size: 30px;
}
.nav-bar {
background: #000;
padding: 0;
width: 100%;
}
.nav {
margin: auto;
padding: 0;
list-style: none;
text-align: center;
width: 100%;
}
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Web Report Demo</title>
<styles></styles>
<link rel="stylesheet" href="ed.css">
</head>
<body>
<div class="container">
<h1 class="header-heading">Web Reporting Demo</h1>
<div class="nav-bar">
<ul class="nav">
<li><a href="dailymaster.php">Daily Master</a></li>
<li><a href="route_progress.php">Route Progress</a></li>
<li><a href="ul_move_query.php">UL Move Query</a></li>
<li><a href="stock_query.php">Stock Query</a></li>
</ul>
</div>
</div>
</body>
嘗試在導航類中添加'clear:both;' – M0ns1f
居中,但現在標題和導航欄堆疊在兩個不同的圖層上,而不是同一個圖層。 –