【发布时间】:2014-05-30 01:49:11
【问题描述】:
如何在文本右下角对齐浮动图像?我有一个具有背景颜色并包含文本的 div。我想在右下角的那个 div 标签中看到一个图像。任何 CSS 解决方案??
<div id="myText">
A lot of text here A lot of text here A lot of text here A lot of text here A lot of text here A lot of text here A lot of text here A lot of text here A lot of text here A lot of text here A lot of text here A lot of text here A lot of text here
<img id ="info_ico" src="images/key_ico.png" />
<div>
#myText
{
background:#fdf6cc;
min-height: 90px;
margin-left:1px;
width: 913 px;
padding-left: 30px;
}
#info_ico
{
float:right;
clear:right;
}
现在要更改什么才能看到文本底部的图像?
【问题讨论】:
-
你有没有试过把图片设置为你的DIV背景,然后background-repeat: no-repeat和background-position: right bottom?也许您还需要设置 DIV 宽度,以便适合文本和图像本身。
-
文字还需要环绕图片吗?
-
是的,文字应该在图片周围。
-
您仍然可以使用图像作为背景,并设置 DIV 右填充。是的,如果您希望在图像顶部显示文本,则整个方法无效。
标签: html css image css-float alignment