为什么在这个布局上不能使用margin-top

时间:2011-04-07 14:53:52

标签: css xhtml margin

我想要这个: http://www.img-share.net/uploads/33986layout.png

但这不起作用 http://jsfiddle.net/RLN8x/1/ 请帮帮我......

2 个答案:

答案 0 :(得分:3)

试用此更新版本:http://jsfiddle.net/RLN8x/5/

您需要将“阻止”设置为相对位置,并使用负top值将其推送到父级之外。

答案 1 :(得分:1)

您可以使用相对定位来代替:

.block {
    position: relative;
    top: -15px;
    background:#eee;
    margin-left:15px;
    margin-right:15px;
    height:30px; 
}
相关问题