課程
/前端開發
/HTML/CSS
/網頁布局基礎
加一個文本mainbody,和示例中顯示不一樣?
2015-12-23
源自:網頁布局基礎 3-5
正在回答
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css">
* {
? ? margin:0;
padding:0;
}
#wrap {
background:#00C;
margin:0 auto;
width:960px;
#header {
background:#FF3300;
width:100%;
#mainbody {
? ?background:#FC0;
? ?width:100%;
? ?overflow: hidden;
.left {
margin-right:20px;
width:800px;
height:200px;
background:#000;
float: left;
.right {
width:140px;
height:500px;
background:#690;
#footer {
background:#639;
</style>
</head>
<body>
<div id="wrap">
? <div id="header">頭部</div>
? <div id="mainbody">
? ? <div class="left"></div>
? ? <div class="right"></div>
? </div>
? <div id="footer">版權部分</div>
</div>
</body>
</html>
#mainbody和.left還有.right寫這樣這也就可以了。
怎么不一樣了?定位沒寫好吧?
Alphonse丿 提問者
迷途的馬爾斯 回復 Alphonse丿 提問者
Alphonse丿 提問者 回復 迷途的馬爾斯
舉報
讓你精通CSS中三大定位機制,徹底掌握網頁布局的相關知識
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2015-12-24
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css">
* {
? ? margin:0;
padding:0;
}
#wrap {
background:#00C;
margin:0 auto;
width:960px;
}
#header {
background:#FF3300;
width:100%;
}
#mainbody {
? ?background:#FC0;
? ?width:100%;
? ?overflow: hidden;
}
.left {
margin-right:20px;
width:800px;
height:200px;
background:#000;
float: left;
}
.right {
width:140px;
height:500px;
background:#690;
float: left;
}
#footer {
background:#639;
width:100%;
}
</style>
</head>
<body>
<div id="wrap">
? <div id="header">頭部</div>
? <div id="mainbody">
? ? <div class="left"></div>
? ? <div class="right"></div>
? </div>
? <div id="footer">版權部分</div>
</div>
</body>
</html>
#mainbody和.left還有.right寫這樣這也就可以了。
2015-12-23
怎么不一樣了?定位沒寫好吧?