Jump to content

center img


madtvo

Recommended Posts

first: put all of you images in div tags like this

<div class="divimagealignment"><img src="http://www.somesite.com/images/someimage.gif" alt="this is an image!" /></div>

Now add this to your style sheet

div.divimagealignment{text-align:center;}

Link to comment
Share on other sites

Can I add one more question? What about if I want the image to appear in the middle of the page? DO I have to change the css, by usingbody {backround: #mycolor url('myimage.gif') center fixed no-repeat;or is there another way out?Thanks to anybody who can help me. :)

Link to comment
Share on other sites

you want to center the background image? I think it automatically does that when you have on no-repeat.And if you want every image center just do this:

img { text-align: center; }

If you do that then all of them will automatically be center. If you want it to be say, right aligned, just do this:

<img src="url" style="text-align:right;">

Link to comment
Share on other sites

Can I add one more question? What about if I want the image to appear in the middle of the page? DO I have to change the css, by usingbody {backround: #mycolor url('myimage.gif') center fixed no-repeat;or is there another way out?Thanks to anybody who can help me. :)

That looks correct: http://www.w3schools.com/css/tryit.asp?fil...ycss_background
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...