开发者

align images to right in a div

开发者 https://www.devze.com 2023-04-12 09:27 出处:网络
i have something like:开发者_StackOverflow中文版 <div id=\"read_more_right\"> <a href=\"1\"><img src=\'1\'></a>

i have something like:

开发者_StackOverflow中文版
<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?


It's text-align: right; instead of only align


You could use:

#read_more_right a{
    float:right;
    clear:right;
}

http://jsfiddle.net/pE47J/


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; }


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:

div#read_more_right 
{ 
text-align: right; 
}


try text-align: right;

I know its not text.. but that's the one you want.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号