问题
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?
回答1:
It's text-align: right; instead of only align
回答2:
You could use:
#read_more_right a{
float:right;
clear:right;
}
http://jsfiddle.net/pE47J/
回答3:
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; }
回答4:
Try text-align: right;
-- you may need to set an explicit width on the div in some cases.
回答5:
I'm not really sure, but I think your syntax is wrong. Try this; it worked for me:
div#read_more_right
{
text-align: right;
}
回答6:
try text-align: right;
I know its not text.. but that's the one you want.
回答7:
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.
来源:https://stackoverflow.com/questions/7745232/align-images-to-right-in-a-div