我被告知要使用position: relative
,但是当我在浏览器中查看它时却没有显示,请您告诉我为什么?
这是我的代码:
HTML:
<div id="box"></div>
CSS:
#box
{
position: relative;
height: 20%;
width: 20%;
background: #366;
}
最佳答案
只需将html, body {height:100%}
添加到您的CSS文件中即可。
http://jsfiddle.net/LGJH4/
关于html - 为什么在CSS中看不到我的盒子?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21578046/