If there are more than one image how to position them in web page

if there are more than one image in a web page how we will position them on the page at desired place.i have to give every image an id and then wrap it in div tag and then in css i will have to position them by giving every image position property like top,bottom,right,left etc. is this right mathod.i think it will be a lot of mess.please tell me the right mathod.

                                                                                                             thank you
                                                                                                         rajinder bali

The way I do this is to have three CSS rules: one each for a left-aligned, centre-aligned and right-aligned image. In the HTML, I wrap the <img> tag in a div, and apply one of those three styles to it. The rules also providing styling for a caption (if any) to go with the image. Within the <div> tag, I manually set the height and width styles.

I don’t have any difficultiy with this. I don’t know if my approach would work for, but you might like to consider it.


Without knowing the structure and layout of the page, it’s difficult to know the best way to position the images. If you can give us more of an idea of what you’re looking for, we might be better able to help.

There’s no need to wrap the image in a <div> tag, you can put an ID on the image itself and target that in the CSS. It’s generally not a good idea to use too much absolute positioning, but to let the images sit in the flow of the document.

That’s true. The main reason I use a <div> is so that it can also contains the caption and possibly an attribution for the image.


thank you. your answer helped me lot