align images to right in a div

左心房为你撑大大i 提交于 2021-02-19 02:33:54

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!