/    Sign up×
Community /Pin to ProfileBookmark

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=”images/building.gif” width=”200″ height=”200″ alt=”Building”/>
<img src=”images/kreke.gif” width=”200″ height=”200″ alt=”Kreke” style=”float:left”/>
<img src=”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?

Thanks

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@LJKSep 23.2004 — Hi -

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,

El
Copy linkTweet thisAlerts:
@cmis04authorSep 23.2004 — Thanks 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 again
Copy linkTweet thisAlerts:
@DaveSWSep 23.2004 — if 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.
Copy linkTweet thisAlerts:
@cmis04authorSep 23.2004 — 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.
×

Success!

Help @cmis04 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...