嗨我想知道是否可以将文本和div中的图像对齐到右边?因为div中的文本会更改并读出我网站上每个成员个人资料名称的名称,在我尝试这样做的时候文本会重叠图像吗?
.prof-content-box-left-lower {
/* [disabled]height: 200px; */
/* [disabled]position: relative; */
margin-top: 25px;
margin-bottom: 5px;
margin-right: 18px;
width: 200px;
position:relative;
float:right;
text-align:right;
z-index:90;
答案 0 :(得分:0)
我想你可能只想让图像浮动正确。请参阅此示例中图像标记上的内联CSS。
<html>
<head>
<style>
.prof-content-box-left-lower {
/* [disabled]height: 200px; */
/* [disabled]position: relative; */
margin-top: 25px;
margin-bottom: 5px;
margin-right: 18px;
width: 200px;
position:relative;
text-align:right;
z-index:90;
background: #CCCCCC;
}
</style>
</head>
<body>
<div class = "prof-content-box-left-lower">
<img src = "http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png" style = "float: right" width = 100 height = 100>
my example text
<div style = "clear: both"></div> <!-- this line clears the float so you can stack these divs, which I expect you probably will-->
</div>
<div class = "prof-content-box-left-lower">
<img src = "http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png" style = "float: right" width = 100 height = 100>
my example text
<div style = "clear: both"></div>
</div>
</body>
</html>