html怎么把内容放在右下角,html – 我如何封装文本在右下角div?
每次我试图做一些似乎简单的CSS,它不工作。
我有一个内容div,包含一个460×160图像。所有我想做的是将图像放在右下角,并将我的文字包围。
text text text text text text ...
所以我想它看起来像:
------------------
| text text text |
| text text text |
| text text -----|
| text text | |
------------------
使用左上角或右上角的图片做蛋糕:
#contents img { float:right; }
------------------
| text text | |
| text text -----|
| text text text |
| text text text |
------------------
现在我如何把它推到底部?
我到目前为止最好的是:
#contents img { float:right; margin-top: 90%} // really needs to be 100%-160px
------------------
| text text |
| text text |
| text text -----|
| text text | |
------------------
在这种情况下,文本不打印在边距,因此在图像上方有空白。
#contents { position:relative; }
#contents img { position:absolute; right:0; bottom:0; }
-or-
// move the img tag under the text in the html and:
#contents img { float:right; margin-top:-160; }
------------------
| text text text |
| text text text |
| text text -----|
| text text | te |
------------------
在这种情况下,文本打印在图像的上方或下方。
所以…我怎么能做到这一点?
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
