Hy guys。Div覆蓋層高度問題
我有一個覆蓋div在另一個div內的情況。
爲什麼主div不適合高度尺寸,當我在內部div中使用位置相對來創建覆蓋。
See the picture 我不能使用position:absolute,因爲我需要在主div內工作的滾動。
看到代碼:
div.main
{
\t width: 300px; height: auto;
\t border: solid 1px black; overflow: auto;
}
\t div.box1
{
\t width: 350px; height: 50px; border: solid 1px red;
}
\t div.box2
{
\t position: relative; top: -52px; left: 0px; z-index: 1;
\t width: 350px; height: 50px; border: solid 1px green;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="main">
\t <div class="box1">box 1</div>
\t <div class="box2">box 2 - overlay</div>
</div>
</body>
</html>
我可以使用另一種CSS設置,但我需要正弦內的div滾動。
因爲這是它的正常/自然的位置,好歹它就像它仍然存在,雖然它不是相對定位。 – VXp