Seeker
Seeker

Reputation: 365

How to align images to the right?

I'm trying to use css to put some images this way:

|_________<img1_1>|___<img2_1>|
|                 |<___img2_2>|
|                 |__<_img2_3>|

All the images should be align right and i cannot use a fixed width size because the size of the images may vary.

Image img1_1 is to the left off all the others (but still align right of the page).

plz help!

Upvotes: 0

Views: 255

Answers (3)

Vlad.P
Vlad.P

Reputation: 1464

You can wrap all the images in a div tag add a class or an id and set the class/id to text-align: right; or float all the images to the right .class img { float: right; }

Upvotes: 0

Bojangles
Bojangles

Reputation: 101473

Using a float: right with an inline-block should work fine.

float can, in some rare cases, produce varying results accross browsers, however it works well 99% of the time.

James

Upvotes: 1

naugtur
naugtur

Reputation: 16915

with CSS

set all images float to right for images 2_2 and 2_3 set clear:right

If it's supposed to be a layout - consider using DIVs to create regions on the page.

Create a content div and put another 2 divs in it. Set float of one of them to right and give it a width. Set a margin on the other one. Put images in them.

Upvotes: 2

Related Questions