Jack Hales
Jack Hales

Reputation: 1644

CSS Vertical Align Image Right

I am trying to align an image to the right of a div, the div is not set as a specific height and neither is the image, the image is user generated.

Anyway, I tried using the old HTML4 method for aligning an image to the right of a div:

<img src="link" align="right" /> 

And after some reading I found out that it wasn't supported in HTML5, so I then read on and found out that there is a CSS style called vertical align, I tried adding that to my image like so:

<img src="link" style="vertical-align:right;" />

But that didn't manage to work.

I simply want the image to move to the right of the div.

Upvotes: 1

Views: 146

Answers (3)

Pedram
Pedram

Reputation: 16575

Another Solution beside of float:

<div id="ParentImg">
<img src="link"/> 
</div>

CSS:

#ParentImg {
text-align: right;
}

or:

<div style="text-align:right;">
<img src="link"/> 
</div>

Upvotes: 3

vimuth
vimuth

Reputation: 5612

you can use a <span></span> tag instead of <div> tag and then change the styles of it.

<span style='text-align:right'>
    <img src="link"  />
</span> 

Upvotes: 0

Bogdan
Bogdan

Reputation: 54

Vertically align to right? doesn't seem right to me. You can use float right on the image or text-align:right on the parent div.

Upvotes: 1

Related Questions