div 中的图像右对齐
我有这样的东西:
<div id="read_more_right">
<a href="1"><img src='1'></a>
<a href="1"><img src='1'></a>
<a href="1"><img src='1'></a>
</div>
我想将所有这些图像在 div 中向右对齐
我使用这个
#read_more_right div
{
align: right;
}
,但它不起作用。我怎样才能将其向右对齐?
i have something like:
<div id="read_more_right">
<a href="1"><img src='1'></a>
<a href="1"><img src='1'></a>
<a href="1"><img src='1'></a>
</div>
i want to align all those images to the right in a div
I use this
#read_more_right div
{
align: right;
}
but it doesn't work. How can I allign this to the right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
它是 text-align: right; 而不仅仅是 align
It's text-align: right; instead of only align
您可以使用:
http://jsfiddle.net/pE47J/
You could use:
http://jsfiddle.net/pE47J/
如果您尝试根据 ID 选择 div,则需要按以下方式声明它:
div#read_more_right { text-align: right; }
If you're trying to select your div based on ID you need to declare it in the following fashion:
div#read_more_right { text-align: right; }
尝试
text-align: right;
——在某些情况下,您可能需要在 div 上设置显式宽度。Try
text-align: right;
-- you may need to set an explicit width on the div in some cases.我不太确定,但我认为你的语法是错误的。试试这个;它对我有用:
I'm not really sure, but I think your syntax is wrong. Try this; it worked for me:
尝试
text-align: right;
我知道它不是文本..但这就是你想要的。
try
text-align: right;
I know its not text.. but that's the one you want.
另请参阅:什么左对齐和右对齐两个 div 标签的最佳方法是什么? 对于类似问题的一些答案和 this 可以很好地概述浮动和对齐属性。
See also: What is the best way to left align and right align two div tags? for some answers to a similar problem and this for a good overview of float and alignment properties.