Is this almost correct?
I'm trying to center a picture, and this is what I have for the html code and css:
code:--------------------------------------------------------------------------------
<div id="main">
<div id="pictures">
<img src=http://www.webdeveloper.com/forum/archive/index.php/"images/building.gif" width="200" height="200" alt="Building"/>
<img src=http://www.webdeveloper.com/forum/archive/index.php/"images/kreke.gif" width="200" height="200" alt="Kreke" style="float:left"/>
<img src=http://www.webdeveloper.com/forum/archive/index.php/"images/etter.gif" width="200" height="200" alt="Etter" style="float:right"/>
</div>
</div>
--------------------------------------------------------------------------------
"main" div has two other div's within it, one is not included in this post
code:--------------------------------------------------------------------------------
div.pictures {
margin-top: 5px;
margin-left: 400px;
}
--------------------------------------------------------------------------------
However, the picture i'm trying to center is the building picture, is my css close? I'm not sure what it's supposed to be, also, how do I make changes to each picture in css that will be independent of the others?
ThanksHi -
It looks to me like you've only applied css to the div - not the building pic. Try giving the image an id then styling with:
#building{
margin:0 auto 0 auto;}
which should center it - depending on what you've used in its container margins, etc.
Be sure to add an element with -
clear:both;
after your floats, so you don't have problems with them, too!
Good luck,
ElThanks for the suggestion, I think you've helped me out huge before. See if this makes since, I was working on all this earlier today at work, everything looked fine on the computer there, but when I got home, everything is so messed up. I have no clue why. The background is white, the navigation links are all out of whack, and the pics are messed up too. Wow. Anyways, I'll try your suggestion at work tomorrow and see how it does. Thanks againif you're looking to apply some css to the images try
#pictures img {
margin: auto;
}
Unfortunately IE doesn't support this... so you'll need to put text-align: center on your #pictures div.Thanks for the suggestion, I just made a div for the picture I was trying to center and moved it over however many px to make it centered.
I'm trying to center a picture, and this is what I have for the html code and css:
code:--------------------------------------------------------------------------------
<div id="main">
<div id="pictures">
<img src=http://www.webdeveloper.com/forum/archive/index.php/"images/building.gif" width="200" height="200" alt="Building"/>
<img src=http://www.webdeveloper.com/forum/archive/index.php/"images/kreke.gif" width="200" height="200" alt="Kreke" style="float:left"/>
<img src=http://www.webdeveloper.com/forum/archive/index.php/"images/etter.gif" width="200" height="200" alt="Etter" style="float:right"/>
</div>
</div>
--------------------------------------------------------------------------------
"main" div has two other div's within it, one is not included in this post
code:--------------------------------------------------------------------------------
div.pictures {
margin-top: 5px;
margin-left: 400px;
}
--------------------------------------------------------------------------------
However, the picture i'm trying to center is the building picture, is my css close? I'm not sure what it's supposed to be, also, how do I make changes to each picture in css that will be independent of the others?
ThanksHi -
It looks to me like you've only applied css to the div - not the building pic. Try giving the image an id then styling with:
#building{
margin:0 auto 0 auto;}
which should center it - depending on what you've used in its container margins, etc.
Be sure to add an element with -
clear:both;
after your floats, so you don't have problems with them, too!
Good luck,
ElThanks for the suggestion, I think you've helped me out huge before. See if this makes since, I was working on all this earlier today at work, everything looked fine on the computer there, but when I got home, everything is so messed up. I have no clue why. The background is white, the navigation links are all out of whack, and the pics are messed up too. Wow. Anyways, I'll try your suggestion at work tomorrow and see how it does. Thanks againif you're looking to apply some css to the images try
#pictures img {
margin: auto;
}
Unfortunately IE doesn't support this... so you'll need to put text-align: center on your #pictures div.Thanks for the suggestion, I just made a div for the picture I was trying to center and moved it over however many px to make it centered.