課程
/前端開發
/HTML/CSS
/網頁布局基礎
就是這個情況,用浮動但是浮動不上去了,因為mainbody
2016-05-19
源自:網頁布局基礎 3-5
正在回答
mianbody文字寫在left和right元素后面就行了
牛牛兀 提問者
你是想把文字覆蓋掉,用positon:absolute 就可以,樓主的方法是把文字移到下邊去了
<body>
<div id="wrap">
? <div id="header">頭部</div>
? <div id="mainbody">
? ? <div class="left">left</div>
? ? <div class="right">right</div>
? ? mianbody
? </div>
? <div id="footer">版權部分</div>
</div>
</body>
<!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;
}
div{font-size:20px;color:white;font-weight:bold;}
#wrap {
background:#00C;
margin:0 auto;
width:960px;
#header {
background:#FF3300;
width:100%;
#mainbody {
? ?background:#FC0;
? ?width:100%;
? ? ? ? overflow:hidden;
.left {
width:800px;
height:200px;
background:#000;
float:left;
.right {
width:140px;
height:500px;
background:#690;
float:right;
#footer {
background:#639;
</style>
</head>
? <div id="mainbody">mainbody
</html>
把代碼放上來,這樣才知道根本原因
舉報
讓你精通CSS中三大定位機制,徹底掌握網頁布局的相關知識
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-05-21
mianbody文字寫在left和right元素后面就行了
2016-07-08
你是想把文字覆蓋掉,用positon:absolute 就可以,樓主的方法是把文字移到下邊去了
2016-05-21
<body>
<div id="wrap">
? <div id="header">頭部</div>
? <div id="mainbody">
? ? <div class="left">left</div>
? ? <div class="right">right</div>
? ? mianbody
? </div>
? <div id="footer">版權部分</div>
</div>
</body>
2016-05-19
<!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;
}
div{font-size:20px;color:white;font-weight:bold;}
#wrap {
background:#00C;
margin:0 auto;
width:960px;
}
#header {
background:#FF3300;
width:100%;
}
#mainbody {
? ?background:#FC0;
? ?width:100%;
? ? ? ? overflow:hidden;
}
.left {
width:800px;
height:200px;
background:#000;
float:left;
}
.right {
width:140px;
height:500px;
background:#690;
float:right;
}
#footer {
background:#639;
width:100%;
}
</style>
</head>
<body>
<div id="wrap">
? <div id="header">頭部</div>
? <div id="mainbody">mainbody
? ? <div class="left">left</div>
? ? <div class="right">right</div>
? </div>
? <div id="footer">版權部分</div>
</div>
</body>
</html>
2016-05-19
把代碼放上來,這樣才知道根本原因