課程
/前端開發(fā)
/HTML/CSS
/企業(yè)網(wǎng)站綜合布局實戰(zhàn)
為啥會這樣。代碼是按照視頻打的
2017-12-17
源自:企業(yè)網(wǎng)站綜合布局實戰(zhàn) 3-4
正在回答
nav?應該在?wrap?里面。你的分開了
weixin_慕后端9203364
我也出現(xiàn)了這個問題
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>無標題文檔</title>
<link href="css/main.css" rel="stylesheet" type="text/css">
<script src="js/setHomeSetFav.js" type="text/javascript" charset="gb2312"></script>
</head>
<body>
<div class="top">
? ?<div class="top_content">
? ? ? <ul>
? ? ? ? ?<li><a href="introduce.html">聯(lián)系我們</a></li>?
? ? ? ? ?<li><a href="#" onclick="AddFavorite(window.location,document.title)">加入收藏</a></li>
? ? ? ? ?<li><a href="#" onclick="SetHome(window.location)">設為首頁</a></li>
? ? ? </ul>
? ?</div>
</div><!--top結(jié)束-->
<div class="wrap">
? ?<div class="logo">
? ? ? <div class="logo_left">
? ? ? ? ?<img src="images/logo.jpg" alt="慕課網(wǎng)"/>
? ? ? </div>
? ? ? <div class="logo_right">
? ? ? ? ?<img src="images/tel.jpg" alt="服務熱線"/>報警電話:<span class="tel">177-0505-7796</span>
</div><!--wrap結(jié)束-->
<div class="nav">
? <div class="nav_left"></div>
? <div class="nav_mid">
? ? ?<div class="nav_mid_left">
? ? ? ? <ul>
? ? ? ? ? <li><a href="#">首頁</a></li>
? ? ? ? ? <li><a href="list.html">關于慕課</a></li>
? ? ? ? ? <li><a href="list.html">新聞動態(tài)</a></li>
? ? ? ? ? <li><a href="list.html">課程中心</a></li>
? ? ? ? ? <li><a href="list.html">在線課程</a></li>
? ? ? ? ? <li><a href="list.html">人才招聘</a></li>
? ? ? ? </ul>
? ? ? <div class="nav_mid_right">
? ? ? ? <form action="" method="post">
? ? ? ? ? <input type="text" class="search_text" />
? ? ? ? </form>
? ? </div><!--nav_mid結(jié)束-->
? ?<div class="nav_right"></div>
</div><!--nav結(jié)束-->
</body>
</html>
* {
padding: 0;
margin: 0;
font-size: 12px;
}
body {
background-color: #F5F5F5;
.wrap {
width: 1000px;
margin: 0 auto;
.top {
width: 100%;
height: 27px;
background: url(../images/top_bg.jpg) repeat-x;
.top_content {
line-height: 27px;
.top_content li {
float: right;
list-style-image: url(../images/arrow.jpg);
width: 70px;
.top_content a:link, .top_content a:visited {
color: #8E8E8E;
text-decoration: none;
.top_content a:hover, .top_content a:active {
color: #C00;
.logo {
height: 80px;
background-color: #FFF;
.logo_left {
width: 375px;
float: left;
display: inline;
.logo_right {
width: 300px;
height: 28px;
margin-top: 30px;
.logo_right img {
vertical-align: middle;
margin-right: 10px;
.tel {
font-family: "微軟雅黑";
font-size: 22px;
.nav {
height: 40px;
clear:both;
.nav_left {
width: 10px;
background: url(../images/nav_left.jpg) no-repeat;
.nav_mid {
width: 980px;
background: url(../images/nav_bg.jpg) repeat-x;
line-height: 40px;
.nav_right {
background: url(../images/nav_right.jpg) no-repeat;
.nav_left, .nav_mid, .nav_right {
.nav_mid li {
list-style-type: none;
width: 100px;
text-align: center;
.nav_mid a:link, .nav_mid a:visited {
font-size: 16px;
color: #FFF;
.nav_mid a:hover, .nav_mid a:active {
color: #FF0;
.nav_mid_left {
width: 680px;
.nav_mid_right {
.nav_mid_left, .nav_mid_right {
.search_text {
width: 190px;
height: 25px;
margin-top: 5px;
background: url(../images/search.jpg) no-repeat right center;
border: 1px solid #FFF;
padding-right: 25px;
慕仰9892961
舉報
本課程重點介紹HTML/CSS實現(xiàn)常見企業(yè)網(wǎng)站布局的方法
4 回答為什么nav_left設置了左浮動,不顯示在nav的最左邊。
1 回答nav中的左邊這塊
1 回答為什么nav的左右不在一行上左右永遠擠出來
2 回答為啥news.li里面的內(nèi)容不左對齊
4 回答為什么左浮動,里左邊距離這么大,不應該是貼著左邊的嗎
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關注慕課網(wǎng)微信公眾號
2018-05-23
2018-03-27
我也出現(xiàn)了這個問題
2017-12-17
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>無標題文檔</title>
<link href="css/main.css" rel="stylesheet" type="text/css">
<script src="js/setHomeSetFav.js" type="text/javascript" charset="gb2312"></script>
</head>
<body>
<div class="top">
? ?<div class="top_content">
? ? ? <ul>
? ? ? ? ?<li><a href="introduce.html">聯(lián)系我們</a></li>?
? ? ? ? ?<li><a href="#" onclick="AddFavorite(window.location,document.title)">加入收藏</a></li>
? ? ? ? ?<li><a href="#" onclick="SetHome(window.location)">設為首頁</a></li>
? ? ? </ul>
? ?</div>
</div><!--top結(jié)束-->
<div class="wrap">
? ?<div class="logo">
? ? ? <div class="logo_left">
? ? ? ? ?<img src="images/logo.jpg" alt="慕課網(wǎng)"/>
? ? ? </div>
? ? ? <div class="logo_right">
? ? ? ? ?<img src="images/tel.jpg" alt="服務熱線"/>報警電話:<span class="tel">177-0505-7796</span>
? ? ? </div>
? ?</div>
</div><!--wrap結(jié)束-->
<div class="nav">
? <div class="nav_left"></div>
? <div class="nav_mid">
? ? ?<div class="nav_mid_left">
? ? ? ? <ul>
? ? ? ? ? <li><a href="#">首頁</a></li>
? ? ? ? ? <li><a href="list.html">關于慕課</a></li>
? ? ? ? ? <li><a href="list.html">新聞動態(tài)</a></li>
? ? ? ? ? <li><a href="list.html">課程中心</a></li>
? ? ? ? ? <li><a href="list.html">在線課程</a></li>
? ? ? ? ? <li><a href="list.html">人才招聘</a></li>
? ? ? ? </ul>
? ? ? </div>
? ? ? <div class="nav_mid_right">
? ? ? ? <form action="" method="post">
? ? ? ? ? <input type="text" class="search_text" />
? ? ? ? </form>
? ? ? </div>
? ? </div><!--nav_mid結(jié)束-->
? ?<div class="nav_right"></div>
</div><!--nav結(jié)束-->
</body>
</html>
* {
padding: 0;
margin: 0;
font-size: 12px;
}
body {
background-color: #F5F5F5;
}
.wrap {
width: 1000px;
margin: 0 auto;
}
.top {
width: 100%;
height: 27px;
background: url(../images/top_bg.jpg) repeat-x;
}
.top_content {
width: 1000px;
margin: 0 auto;
line-height: 27px;
}
.top_content li {
float: right;
list-style-image: url(../images/arrow.jpg);
width: 70px;
}
.top_content a:link, .top_content a:visited {
color: #8E8E8E;
text-decoration: none;
}
.top_content a:hover, .top_content a:active {
color: #C00;
text-decoration: none;
}
.logo {
height: 80px;
background-color: #FFF;
}
.logo_left {
width: 375px;
float: left;
display: inline;
}
.logo_right {
width: 300px;
height: 28px;
margin-top: 30px;
float: right;
display: inline;
color: #8E8E8E;
}
.logo_right img {
vertical-align: middle;
margin-right: 10px;
}
.tel {
font-family: "微軟雅黑";
font-size: 22px;
color: #C00;
}
.nav {
height: 40px;
clear:both;
}
.nav_left {
width: 10px;
background: url(../images/nav_left.jpg) no-repeat;
}
.nav_mid {
width: 980px;
background: url(../images/nav_bg.jpg) repeat-x;
line-height: 40px;
}
.nav_right {
width: 10px;
background: url(../images/nav_right.jpg) no-repeat;
}
.nav_left, .nav_mid, .nav_right {
height: 40px;
float: left;
display: inline;
}
.nav_mid li {
float: left;
list-style-type: none;
width: 100px;
font-family: "微軟雅黑";
text-align: center;
}
.nav_mid a:link, .nav_mid a:visited {
font-size: 16px;
color: #FFF;
text-decoration: none;
}
.nav_mid a:hover, .nav_mid a:active {
font-size: 16px;
color: #FF0;
text-decoration: none;
}
.nav_mid_left {
width: 680px;
}
.nav_mid_right {
width: 300px;
}
.nav_mid_left, .nav_mid_right {
float: left;
display: inline;
}
.search_text {
width: 190px;
float: left;
height: 25px;
margin-top: 5px;
background: url(../images/search.jpg) no-repeat right center;
background-color: #FFF;
border: 1px solid #FFF;
padding-right: 25px;
}