晚上好,我正在一个页面上工作,当我在firefox中测试页面时,页面上的下拉菜单没有直接下降。它们实际上出现在页面底部。我尝试了css重置,但这不起作用。我相信正在发生的事情是,菜单正在低于导航部分下方的div下面,但看看并让我知道你的想法。谢谢。我已经包含了索引页面的所有代码。如果有人也可以给我两个方法在IE的旧版本中很好地显示这个也很棒的方法。
<!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>
<!-- adds the small logo to title tab -->
<title>Shattered Kingdoms</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--Stylesheets-->
<link rel="stylesheet"href="style.css"/>
<!-- Start WOWSlider.com HEAD section -->
<link rel="stylesheet" type="text/css" href="engine1//style.css" media="screen" />
<script type="text/javascript" src="engine1//jquery.js"></script>
<!-- End WOWSlider.com HEAD section -->
<link res="stylesheet"href="reset.css"/>
</head>
<body>
<div id="outpage">
<div id="mainpage">
<div id="smallnav">
211/500 users online
</div>
<div id="logospace">
<!-- Start WOWSlider.com BODY section id=wowslider-container1 -->
<div id="wowslider-container1">
<div class="ws_images"><ul>
<li><img src="data1/images/1ff7hqgh.jpg" alt="Shattered Kingdoms" title="Shattered Kingdoms" id="wows1_0"/></li>
<li><img src="data1/images/u7prvqgh.jpg" alt="Huge Worlds" title="Huge Worlds" id="wows1_1"/></li>
<li><img src="data1/images/szao1yrh.jpg" alt="Jesus" title="Minecraft Jesus" id="wows1_2"/></li>
<li><img src="data1/images/rq0mingh.jpg" alt="Meth Guys" title="Minecraft Meth Heads" id="wows1_3"/></li>
<li><img src="data1/images/mnbojogh.jpg" alt="Swords" title="Swords" id="wows1_4"/></li>
<li><img src="data1/images/la5v7i4h.jpg" alt="Lego" title="A.D.D. sufferers dream!" id="wows1_5"/></li>
<li><img src="data1/images/iymmqjeh.jpg" alt="Swords2" title="More Swords" id="wows1_6"/></li>
<li><img src="data1/images/e9max09h.jpg" alt="Cowlove" title="Beastiality" id="wows1_7"/></li>
<li><img src="data1/images/9xpex0oh.jpg" alt="Expansive landscape" title="Expansive Landscape" id="wows1_8"/></li>
</ul></div>
<div class="ws_bullets"><div>
<a href="#" title="Shattered Kingdoms"><img src="data1/tooltips/1ff7hqgh.jpg" alt="Shattered Kingdoms"/>1</a>
<a href="#" title="u7prvQgh"><img src="data1/tooltips/u7prvqgh.jpg" alt="u7prvQgh"/>2</a>
<a href="#" title="SZAo1yRh"><img src="data1/tooltips/szao1yrh.jpg" alt="SZAo1yRh"/>3</a>
<a href="#" title="Rq0miNgh"><img src="data1/tooltips/rq0mingh.jpg" alt="Rq0miNgh"/>4</a>
<a href="#" title="MnbOjOGh"><img src="data1/tooltips/mnbojogh.jpg" alt="MnbOjOGh"/>5</a>
<a href="#" title="lA5V7I4h"><img src="data1/tooltips/la5v7i4h.jpg" alt="lA5V7I4h"/>6</a>
<a href="#" title="iymMqjEh"><img src="data1/tooltips/iymmqjeh.jpg" alt="iymMqjEh"/>7</a>
<a href="#" title="e9Max09h"><img src="data1/tooltips/e9max09h.jpg" alt="e9Max09h"/>8</a>
<a href="#" title="9XPeX0oh"><img src="data1/tooltips/9xpex0oh.jpg" alt="9XPeX0oh"/>9</a>
</div></div>
<span class="wsl"><a href="http://wowslider.com">Slider HTML5</a> by WOWSlider.com v4.7</span>
<a href="#" class="ws_frame"></a>
<div class="ws_shadow"></div>
</div>
<script type="text/javascript" src="engine1//wowslider.js"></script>
<script type="text/javascript" src="engine1//script.js"></script>
<!-- End WOWSlider.com BODY section -->
</div>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Register/login</a>
<ul>
<li><a href="register.php">Register</a></li>
<li><a href="login.php">Login</a></li>
<li><a href="#">Forgot Password</a>
<ul>
<li><a href="#">Email Password</a></li>
<li><a href="#">Answer Security Questions</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">Contact Us</a>
<ul>
<li><a href="#">Email</a></li>
<li><a href="#">Forum</a></li>
</ul>
</li>
<li><a href="#">Contact Us</a>
<ul>
<li><a href="#">Email</a></li>
<li><a href="#">Forum</a></li>
</ul>
</li>
<li><a href="#">Contact Us</a>
<ul>
<li><a href="#">Email</a></li>
<li><a href="#">Forum</a></li>
</ul>
</li>
<li><a href="#">Contact Us</a>
<ul>
<li><a href="#">Email</a></li>
<li><a href="#">Forum</a></li>
</ul>
</li>
</ul>
</nav>
<div id="article">
<h1>Content Goes Here</h1>
</div>
<div id="legaljibjab">
copyright John Snow 2013
</div>
</div>
</div>
</body>
</html>
和CSS
k@charset "utf-8";
/* CSS Document */
html{
height:100%;
width:100%;
}
body{
height:100%;
width:100%;
}
#outpage{
margin:0;
height:100%;
width:100%;
border:black solid medium;
background-image: -o-linear-gradient(bottom, rgb(0,0,102) 24%,rgb(153,153,153) 62%);
background-image: -moz-linear-gradient(bottom, rgb(0,0,102) 24%,rgb(153,153,153) 62%);
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.24, rgb(0,0,102)), color-stop(0.62, rgb(153,153,153)));
background-image: -webkit-linear-gradient(bottom, rgb(0,0,102) 24%,rgb(153,153,153) 62%);
background-image: -ms-linear-gradient(bottom, rgb(0,0,102) 24%,rgb(153,153,153) 62%);
background-image: linear-gradient(bottom), rgb(0,0,102) 24%,rgb(153,153,153) 62%);}
#mainpage{
width:1024px;
height:100%;
margin:0 auto;
background:#FFFFFF;
box-shadow: 0 0 15px #333333; /* all latest browser */
-moz-box-shadow: 0 0 15px #333333; /* Firefox older version*/
-webkit-box-shadow: 0 0 10px #333333; /* Chrome/Safari older version */
}
#smallnav{
height:20px;
width:1024px;
background:#FFFFFF;
}
#logospace{
width:auto;
height:365px;
}
#logospace>h1{
text-align:center;}
nav{
height:80px;
width:1024px;
}
ul{
padding:0;
margin:0;
list-style:none;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 75px;
border-radius: 10px;
list-style: none;
position: relative;
display: inline-table;
z-index:100;
}
nav ul:after {
content: ""; clear: both; display: block;
}
li {
float: left;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block; padding: 25px 40px;
color: #757575; text-decoration: none;
}
nav ul ul {
background: #5f6975; border-radius: 0px; padding: 0;
position: absolute; top: 100%;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
}
nav ul ul li a {
padding: 15px 40px;
color: #fff;
}
nav ul ul li a:hover {
background: #4b545f;} }
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
li ul {
display: none;
position: absolute;
top: 1em;
left: 0;
}
li > ul {
top: auto;
left: auto;
}
li:hover ul, li.over ul{ display: block; }
#article{
height:500px;
width:1024px;
background:#FFFFFF;}
#article>h1{
text-align:center;}
#legaljibjab{
height:30px;
width:1024px;
border:black solid thin;
background:#FFFFFF;}
答案 0 :(得分:0)
ul
中nav
上的水平填充太大,导致菜单栏换行。 (不知道为什么它在其他浏览器中不会这样做。)
解决方案:稍微减少填充,直到菜单栏适合一行。