<body>
...other stuff...
<div style="width: 30px; margin-left: 500px; bottom: 0px;">
<img src="picture.png">
</div>
</body>
margin-left正在工作。想不通为什么画面不会粘底..CSS底部不影响元素
<body>
...other stuff...
<div style="width: 30px; margin-left: 500px; bottom: 0px;">
<img src="picture.png">
</div>
</body>
margin-left正在工作。想不通为什么画面不会粘底..CSS底部不影响元素
对于bottom
是有效的,你必须也使用position
设置为relative
或absolute
:
<div style="position:absolute; width: 30px; margin-left: 500px; bottom: 0">
<img src="picture.png">
</div>
使用absolute
或relative
位置取决于你的布局要求。
注:随着position
集,你也可以使用left
,right
和top
。
该元素缺少position
规则使bottom
生效。 quirksmode在CSS定位上有很好的文章。
我认为你正在寻找这样的事情。
<div style="width: 30px; margin-left: 500px;">
<img src="picture.png" style='display: block;'>
</div>
img在默认情况下有一定的空间,低于文本基线。这不是保证金或填充。最常见的改变方法是将图像的显示设置为阻止。
明白了。谢谢。 – Norse 2012-02-26 09:06:54
@ user1093634:不客气:) – Sarfraz 2012-02-26 09:07:44