最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

絕對(duì)定位影響問(wèn)題

<style type="text/css">

*{

margin: 0px;padding:0px;

}

.wrap{

background:#ccc;height:160px;

}

.box1{

background:red;height:60px;

.box2{

background:blue;height:50px;

}

.box3{

background:green;height:40px;position: absolute;top:40px;left: 50px;

}

</style>

</head>

<body>

<div class="wrap">

<div class="box1">box1</div>

<div class="box2">box2</div>

<div class="box3">box3box3box3</div>

</div>

</body>

</html>

請(qǐng)問(wèn)這個(gè)代碼為什么box2 和box1 css樣式都顯示不出來(lái),我把box2 和box1 都設(shè)置成相對(duì)定位,又可以,請(qǐng)問(wèn)這是為什么?,因?yàn)榻^對(duì)定位對(duì)兄弟元素也有影響嗎?

正在回答

1 回答

.box1少了一個(gè)括號(hào),還有注意代碼書寫格式,CSS樣式不要寫在一行,不利于排查BUG,也不利于別人理解你的代碼

*{
	margin:0px;
	padding:0px;
}
.wrap{
	background:#ccc;
	height:160px;
}
.box1{
	background:red;
	height:60px;
}
.box2{
	background:blue;
	height:50px;
}
.box3{
	background:green;
	height:40px;
	position:absolute;
	top:40px;
	left:50px;
}
</style>
</head>
<body>
<div?class="wrap">
	<div?class="box1">box1</div>
	<div?class="box2">box2</div>
	<div?class="box3">box3box3box3</div>
</div>
</body>


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

短發(fā)是小丸子 提問(wèn)者

非常感謝!
2017-05-31 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
網(wǎng)頁(yè)布局基礎(chǔ)
  • 參與學(xué)習(xí)       214668    人
  • 解答問(wèn)題       1833    個(gè)

讓你精通CSS中三大定位機(jī)制,徹底掌握網(wǎng)頁(yè)布局的相關(guān)知識(shí)

進(jìn)入課程

絕對(duì)定位影響問(wèn)題

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)