我正在开发此website,我希望右侧边栏具有100%的高度。CSS div 100%高度
body {
height: 100%;
min-height: 100%;
position: relative;
}
mydiv {
height: 100%;
min-height: 100%;
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 290px;
}
我已经读了很多答案,尤其是这(Prestaul答案): Setting 100% height on an absolutely positioned element when the content expands past the window size。
但对我来说这个伎俩不起作用,小提琴例句也不起作用!
This is the jsfiddle working example.
This is the same code that doesn't work.
你的意思是在顶部的几个像素的空白?设置你的身体的边缘为'0',它应该工作。 – hsan