gpt4 book ai didi

php - 导航菜单不在位

转载 作者:行者123 更新时间:2023-11-28 12:49:39 24 4
gpt4 key购买 nike

似乎找不到导航菜单布局有什么问题...它没有以 div 容器为中心。顺便说一下,它不是原始菜单,它最初是没有图形的纯 css 菜单,但有同样的问题。因为我找不到问题所在,所以我找到了一个工作示例,但是当我的代码中包含同样的问题时。

请帮忙...谢谢。

enter image description here

    <html>
<head>
<title>Home</title>
</head>
<link href="home.css" rel="stylesheet" type="text/css" />

<script src="js/jquery-1.11.0.min.js"></script>

<body>
<div id="container">
<div class="header-cont">
<div class="header">
<img src="images/header.png"></img>
<?php require ("testnavigation.php"); ?>
</div>
</div>

<div id="content-container1">


<div id="section-navigation">
<p>sidebar navigation</p>
</div>
<div id="content">
<p>contents here</p>
</div>

<div id="aside">
<h3>Aside heading</h3>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit
esse molestie consequat, vel illum dolore eu feugiat nulla
facilisis at vero eros et accumsan.</p>
</div>
<div id="footer">Copyright © Site name, 20XX</div>
</div>
</div>
</body>
</html>

这是CSS

body {
//font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, Sans-Serif;
//font-size: 12px;
background: #0E2B43;
}

.header-cont {
width: 100%;
position: fixed;
top: 0px;
left: 0px;
}

.header > img {
horizontal-align: middle;
vertical-align: middle;
}

.header {
height: 122px;
background: #333;
//border: 1px solid #CCC;
width: 100%;
margin: 0px auto;
}

#container {
margin: 0 auto;
width: 100%;
//width: 966px;
background: #33FF99;
}

#header h1 {
margin: 0;
}

#content-container1 {
float: left;
width: 100%;
background-color: #e9eaed;
margin: 122px auto;
}

#content-container2 {
float: left;
width: 100%;
}

#content {
float: left;
width: 40%;
padding: 20px 0;
margin: 0 0 0 2%;
}

#content h2 {
margin: 0;
}

#aside {
float: right;
width: 35%;
padding: 20px 0;
margin: 0 2% 0 0;
display: inline;
}

#aside h3 {
margin: 0;
}

#footer {
clear: both;
background: #ccc;
text-align: right;
padding: 20px;
height: 1%;
}

#content h1 { //
margin: 1em 0 0.5em 0;
color: #343434;
font-weight: normal;
font-size: 30px;
line-height: 40px; //
font-family: 'Orienta', sans-serif;
border-bottom: 1px solid rgba(53, 86, 129, 0.3);
}

/* These are used on the sidebar */
#section-navigation {
float: left;
width: 16%;
padding: 20px 0;
margin: 0 2%;
display: inline; //
background-color: #ccc;
}

#section-navigation ul {
margin: 0;
padding: 0;
}

#section-navigation ul li {
margin: 0 0 1em;
padding: 0;
list-style-type: none;
}

#section-navigation li a {
display: block;
margin: 0 0px 0 0;
width: auto;
text-decoration: none;
}
/* These are used on the sidebar */

/* These are used on the header navigation */
.clearer {
clear: both;
}

#navigation-row {
background: #aeb5b8 url("images/navigation-bg.gif") repeat-x left top;
height: 38px;
border-left: solid 1px #818b8f;
border-right: solid 1px #818b8f;
//width: 920px;
width: 100%;
margin: 0px auto;
}

ul#navigation {
display: block;
float: left;
list-style: none;
background: url("images/nav-spacer.gif") repeat-y -1px top;
height: 38px;
}

ul#navigation li {
display: block;
float: left;
background: url("images/nav-spacer.gif") repeat-y right top;
height: 38px;
padding-right: 2px;
}

ul#navigation li a {
display: block;
float: left;
line-height: 38px;
padding: 0px 20px;
font-family: Verdana;
font-size: 14px;
color: #313a3e;
text-decoration: none;
// text-transform: uppercase;
letter-spacing: -1px;
}

ul#navigation li a:hover, ul#navigation li a.active {
background: url("images/nav-bg-hover.gif") repeat-x left top;
}

这是navigation.php

<div id="navigation-row">
<ul id="navigation">
<li><a href="Home.php">Home</a></li>
<li><a href="#">Account</a></li>
<li><a href="logout.php">Logout</font></a></li>
</ul>

<div class="search">
<form action="search.php" method="POST">
<input name="search" type="text" maxlength="30" class="textfield"
value="search" />

</form>
</div>

<div class="clearer"></div>
</div>

最佳答案

我的猜测是您的 ul#navigation 继承了默认用户代理的样式表,它在 Chrome 中有 16px 的边距。如果您将 margin: 0; 添加到该规则,我想您可能会得到想要的结果。

关于php - 导航菜单不在位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24197639/

24 4 0
文章推荐: php - 是否应该在服务器端使用 XML,而在客户端使用 JSON?
文章推荐: javascript - 如何使用jquery删除表中的
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com