Re: [問題] 父div的高度只包含了一個子div
※ 引述《icetreen》之銘言:
: <div id="A">
: <div id="B">
: </div>
: <div id="C">
: </div>
: </div>
: 這是我原始想要的三個圖層,但只有B圖層有設height
: 結果變成這樣
: ┌─────────────┐
: │A │
: │┌───────────┐│
: ││B ││
: └┴───────────┴┘
: ┌───────────┐
: │C │
: │ │
: └───────────┘
: 我以為父DIV的高度自動會變成所包含所有子DIV的高度,請問一下要加什麼參數嗎?
: 這麼基本的問題快把我搞瘋了@@
: 謝謝><
: ※ 編輯: icetreen 來自: 220.229.80.88 (12/22 12:11)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>⊥ꢙ憿霁隇隞똼/title>
<style type="text/css">
<!--
.style1 {
color: #FF0000;
position:absolute;
border:1px #FF0000 solid;
height:200px;
width:200px;
left:100px;
top:100px;
}
.style2 {
color: #0000FF;
position:relative;
border:1px #00FF00 solid;
height:100px;
}
.style3 {
color: #FF00FF;
position:relative;
border:1px #00FF00 solid;
height:auto;
}
-->
</style>
</head>
<body>
<div class="style1">
aaaaaaaaaaaaaaaaaa
<div class="style2">
bbbbbbbbbbbbbbbbbbbb
</div>
<div class="style3">
cccccccccccccccccccccccc
</div>
</div>
</body>
</html>
以上!自已玩玩看囉!我用dw寫的。
--
朝叩朱門吃餘餐
嗟來冷眼有德顏
歸途踏盡金磚路
漫天彩霞不用錢
吾乃…富貴乞丐-花爵百鍊生
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.32.171.66
→
12/22 13:36, , 1F
12/22 13:36, 1F
推
12/22 13:44, , 2F
12/22 13:44, 2F
推
12/22 15:44, , 3F
12/22 15:44, 3F
→
12/23 01:07, , 4F
12/23 01:07, 4F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 3 篇):