我有4个div
元素,一个接一个。第1,第2和第4工作正常,但第3 div
没有正确定位。我正在设定它的位置,但它没有遵循......我的代码..
.mid_table
div
左对齐,但我希望它遵循CSS中给出的坐标。
#top_table {
background-image: url(images/Round%20corner);
background-repeat: no-repeat;
background-position: center top;
height: 25px;
}
#bottom_table {
background-image: url(images/Round%20corner);
background-repeat: no-repeat;
background-position: center bottom;
height: 25px;
}
#mid_table {
background-color: #09F;
left: 54px;
width: 449px;
height: 200px;
position: relative;
}
<body>
<div id="logo" >
<center>
<h1><b> Portal</b></h1>
</center>
</div>
<div id="top_table">
<!-- empty -->
</div>
<div id="mid_table">
Content for id "mid_table" Goes Here
</div>
<div id="bottom_table">
Content for id "bottom_table" Goes Here
</div>
<div>
</body>
答案 0 :(得分:0)
你试过吗
position: relative
? 位置:绝对只有在对其他东西“绝对”时才会起作用。因此需要定位父母祖先,例如职位:亲属
答案 1 :(得分:0)
有位置:亲戚应该工作。 (你已经在你的CSS中拥有相对位置,所以我猜这是编辑的人)
您正在测试哪种浏览器?如果它不适合您,则可能是浏览器问题。
你可以在这里查看。
同样在你的html中,底部有一个未封闭的div标签。
答案 2 :(得分:0)
我没有看到可能会破坏第三个div显示的错误。在/ body标记之前只有未公开的div。你的浏览器是什么? 坐标与给定的属性相对位置一起工作。