我已經構建了大量的div,其中有一個作爲包裝器的父代,其中一個子元素將大小調整爲父代的一部分,然後滾動以進行溢出,但無法獲取這個具體的一個權利由於某種原因。子DOM元素沒有調整大小
我有一個父容器 - >第一個孩子是一個頭 - >第二個孩子包含的內容和大小來填充父 - 頭。
我已經將父母定位在絕對位置並附加到document.body,以便它可以填充整個屏幕減去一點寬度和高度。
當我調整我的內容元素滾動,如果超過給定的高度行爲就好像它根本沒有父母,甚至沒有document.body。寬度工作完美;然而,不希望的行爲只發生在以百分比形式設置高度時,如果以像素爲單位進行設置,則會發生這種情況。但是,由於填滿了整個屏幕,我需要設置高度百分比,並且人們有不同類型的具有不同像素設置的不同類型的屏幕。
blueprintsViewer div尺寸正確。
printContainer div溢出blueprintsViewer並超過屏幕高度。行爲是一樣的,如果我沒有正確地設置它的位置或它的父母的位置。
<div id="blueprintsViewer" style="max-width: 98.75%; max-height: 98%;">
<div class=" blueprintsHead"><span class=" rndClose" title="Close"></span><a class=" acLink" title="Append door schedule">Door schedule</a></div>
<div class=" printContainer" style="max-height: 75%;"><img src="/api/drawings a=e&id=4309"><img src="/api/drawings?a=d&id=4309"></div>
</div>
--Here是的CSS樣式
#blueprintsViewer {
position: absolute;
top: 5px;
left: 10px;
padding: 10px;
height:auto;
overflow:visible;
background-color: rgba(45, 45, 45, 0.65);
border-radius: 5px;
-moz-border-radius: 5px;
z-index: 20001;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
-webkit-box-shadow: 0 4px 12px rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.5);
-moz-box-shadow: 0 4px 12px rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.5);
box-shadow: 0 4px 12px rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.5);
}
.blueprintsHead {
width: 100%;
height: 40px;
position:relative;
/*cursor: move;*/
padding: 2px;
background-color: #fff;
border-bottom: 2px groove #39c;
background-image: url(in25.png);
background-repeat: no-repeat;
background-position: 5px center;
text-align: right;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
-moz-border-radius-topleft: 3px;
-moz-border-radius-topleft: 3px;
}
.blueprintsHead > a {
text-decoration: underline;
margin-right: 4em;
margin-top: 1em;
padding: .2em;
display:block;
width:80px;
}
.blueprintsHead >span.rndClose {zoom:1.4 !important; top:5px;right:5px;}
#blueprintsViewer img {
margin-bottom:10px;
}
#blueprintsViewer .printContainer {
position: relative;
margin: 5px;
margin-left:-1px;
width: 100%;
overflow:scroll;
}
--Here是一個屏幕快照。
在深色背景下方的屏幕截圖中,父級「div#blueprintsViewer」和div.printContainer溢出了div#blueprintsViewer,這是我想要克服的行爲。
------------------------------------工作觀衆的快照---------------------
是顯示的圖像?你也應該關閉圖像標籤 – caramba 2013-03-17 22:39:11
關閉圖像標籤是必要的xhtml。與html5
和等都很好(沒有自閉/>) – Stephan 2013-03-17 22:48:38
@stephan,好的謝謝。我也希望他檢查img標籤,因爲有一個空間,(我的第一個img src) – caramba 2013-03-17 23:08:27