爲什麼標題導航會隨着瀏覽器大小調整而中斷?如何解決它?我嘗試過不同的方式,但我沒有發現問題!我請求某人解釋並解決問題。請幫忙。標題導航中斷瀏覽器調整大小
HTML
<!DOCTYPE>
<html="en">
<head>
<title>NewsHour24</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<div class="logo">
<img src="imgs/logo.png" alt="News Hour 24 logo"/>
</div>
<nav>
<div class="header-nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Technology</a></li>
<li><a href="#">Health</a></li>
<li><a href="#">Sports</a></li>
<li><a href="#">Education</a></li>
<li><a href="#">Entertainment</a></li>
<li><a href="#">Support</a></li>
<li><a href="#">Sign Up</a></li>
</ul>
</div>
</nav>
</header> <!-------------*Header ends here*-------------->
<div class="content-area">
<div class="content">
<h1>News Hour 24</h1>
<p>NH24 is a free online NEWS site. NH24 stands for News Hour 24. Our aim is to circulate truth,unbiased and latest news of 24 hours.NH24 covers all news </p>
<p>You can easily update and share news with us.Your collaboration is our expectation</p>
<h3>header3</h3>
<p>paragraph paragraph paragraph</p>
</div>
<footer>
<p>Footer</p>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Technology</a></li>
<li><a href="#">Health</a></li>
<li><a href="#">Sports</a></li>
<li><a href="#">Education</a></li>
<li><a href="#">Entertainment</a></li>
<li><a href="#">Support</a></li>
<li><a href="#">Sign Up</a></li>
</ul>
</footer>
</div>
</body>
</html>
CSS:
/**
* html5doctor.com Reset Stylesheet v1.6.1 (http://html5doctor.com/html-5-reset-stylesheet/)
* Richard Clark (http://richclarkdesign.com)
* http://cssreset.com
*/
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
body {
line-height:1;
}
article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section {
display:block;
}
nav ul {
list-style:none;
}
blockquote, q {
quotes:none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content:'';
content:none;
}
a {
margin:0;
padding:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
/* change colours to suit your needs */
ins {
background-color:#ff9;
color:#000;
text-decoration:none;
}
/* change colours to suit your needs */
mark {
background-color:#ff9;
color:#000;
font-style:italic;
font-weight:bold;
}
del {
text-decoration: line-through;
}
abbr[title], dfn[title] {
border-bottom:1px dotted;
cursor:help;
}
table {
border-collapse:collapse;
border-spacing:0;
}
/* change border colour to suit your needs */
hr {
display:block;
height:1px;
border:0;
border-top:1px solid #cccccc;
margin:1em 0;
padding:0;
}
input, select {
vertical-align:middle;
}
/*-------------------------------------CSS RESET ENDS----------------------------*/
body {
background-color: #7CB038;
width:auto;
}
header {
width:auto;
background:red;
height: 150px;
}
.logo{
float: left;
clear: both;
margin:10px 5px 1px 110px;
width:200px;
height:66px;
}
nav {
display:block;
padding:0;
font-size: 1.3em;
text-align:center;
padding:0;
list-style-type:none;
margin: 0px 5px 10px 0px;
height:50px;
}
nav ul li {
display: inline;
border-right:5px solid #fff ;
padding:10px;
}
nav a{
display:inline-block;
text-decoration: none;
color:white;
display:inline-block;
}
.content-area{
margin: 0 auto;
font-family: sans-serif; open-sans;
width:60%;
}
如何在菜單中出現窗口調整大小...? – Manoj
請不要在css中使用px,請在css中使用%,這樣可以避免在小屏幕中出現中斷並適合 –