/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] centering a div (not the text in it)

I’m not sure if I’ve done it before, but (if there is a way) what is the css to center a div tag. I can’t remember how to do it.

This just made the text center:

[CODE]#content {
[B]text-align:center;[/B]
border:5px #000066 ridge;
background-color:#93DCFF;
padding:7px;
width:575px;
height:auto;
}[/CODE]

This code caused what is seen in the [URL=http://www.webdeveloper.com/forum/attachment.php?attachmentid=7151&stc=1]attached image[/URL]:

[CODE]<div id=”content” align=”center”>[/CODE]

I don’t want to use <center><div>…stuff…</div></center>

here is the page:
[url]http://wizcreations.com/newsite/[/url]

[upl-file uuid=ebcf39aa-72ba-44c3-a73c-14db0429bc15 size=92kB]error.jpg[/upl-file]

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@KravvitzJun 30.2006 — [url=http://www.dynamicsitesolutions.com/css/center_element/]Four ways to Center Elements with CSS (in IE5+/Win and other browsers)[/url]
Copy linkTweet thisAlerts:
@Wiz_CreationsauthorJun 30.2006 — i got it by adding [B]margin:0px auto;[/B] to both the body and #content items in the css.
×

Success!

Help @Wiz_Creations 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.6,
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,
)...