課程
/前端開發(fā)
/HTML/CSS
/網(wǎng)頁布局基礎(chǔ)
兩個(gè)浮動(dòng)的div寬度加起來沒有超過960,怎么會(huì)在只設(shè)置左浮動(dòng)的時(shí)候兩個(gè)div不能并排顯示?
2016-12-07
源自:網(wǎng)頁布局基礎(chǔ) 3-3
正在回答
圖片在這里
Amaranta
qq_銜尾蛇_(dá)0 回復(fù) Amaranta
我打代碼試了下,確實(shí)沒有并排
<!DOCTYPE html>
<html>
<head>
? ? <meta charset="utf-8">
? ? <title></title>
</head>
<style>
? ? * {
? ? ? ? margin: 0;
? ? ? ? padding: 0;
? ? }
? ? #warp {
? ? ? ? margin: 5px auto;
? ? ? ? width: 960px;
? ? #header {
? ? ? ? background-color: grey;
? ? #body {
? ? ? ? background-color: yellow;
? ? #footer {
? ? ? ? background-color: blue;
? ? .left {
? ? ? ? background-color: red;
? ? ? ? float: left;
? ? ? ? width: 500px;
? ? .right {
? ? ? ? background-color: green;
? ? ? ? width: 350px;
</style>
<body>
? ? <div id="warp">
? ? ? ? <div id="header">header
? ? ? ? </div>
? ? ? ? <div id="body">body
? ? ? ? ? ? <div class="left">
? ? ? ? ? ? ? ? left
? ? ? ? ? ? </div>
? ? ? ? ? ? <div class="right">
? ? ? ? ? ? ? ? right
? ? ? ? <div id="footer">
? ? ? ? ? ? footer
? ? </div>
</body>
</html>
</div>
<div id="footer">
qq_銜尾蛇_(dá)0
qq_銜尾蛇_(dá)0 回復(fù) qq_銜尾蛇_(dá)0
兩個(gè)div的浮動(dòng)都要設(shè)置
上代碼
舉報(bào)
讓你精通CSS中三大定位機(jī)制,徹底掌握網(wǎng)頁布局的相關(guān)知識
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2017-02-18
圖片在這里
2017-02-18
我打代碼試了下,確實(shí)沒有并排
<!DOCTYPE html>
<html>
<head>
? ? <meta charset="utf-8">
? ? <title></title>
</head>
<style>
? ? * {
? ? ? ? margin: 0;
? ? ? ? padding: 0;
? ? }
? ? #warp {
? ? ? ? margin: 5px auto;
? ? ? ? width: 960px;
? ? }
? ? #header {
? ? ? ? background-color: grey;
? ? }
? ? #body {
? ? ? ? background-color: yellow;
? ? }
? ? #footer {
? ? ? ? background-color: blue;
? ? }
? ? .left {
? ? ? ? background-color: red;
? ? ? ? float: left;
? ? ? ? width: 500px;
? ? }
? ? .right {
? ? ? ? background-color: green;
? ? ? ? width: 350px;
? ? }
</style>
<body>
? ? <div id="warp">
? ? ? ? <div id="header">header
? ? ? ? </div>
? ? ? ? <div id="body">body
? ? ? ? ? ? <div class="left">
? ? ? ? ? ? ? ? left
? ? ? ? ? ? </div>
? ? ? ? ? ? <div class="right">
? ? ? ? ? ? ? ? right
? ? ? ? ? ? </div>
? ? ? ? </div>
? ? ? ? <div id="footer">
? ? ? ? ? ? footer
? ? ? ? </div>
? ? </div>
</body>
</html>
</div>
<div id="footer">
</div>
</div>
</body>
</html>
2016-12-07
兩個(gè)div的浮動(dòng)都要設(shè)置
2016-12-07
上代碼
2016-12-07
上代碼