Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 1, 2026.

Center site with div container?

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

oberheimer

Established Member
Impact
51
I'm designing a site with div's but there is somehting wrong.

How can i center the whole site as it is now it's aligned left

I will chnage colours and everything later and ad content, it's just so i can keep track of all the divs :p

if you look here http://www.ripwear.com/index.html
and http://www.ripwear.com/style.css

Can anyone help me out
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
You forgot px. Change this:
#container {
width: 1220;
}


To this:
#container {
width: 1220px;
}

Btw, I like your domain. It's very nice.
 
Last edited:
0
•••
You forgot px. Change this:



To this:
#container {
width: 1220px;
}

Btw, I like your domain. It's very nice.


lol was it that simple...
But thanks alot for the help
 
0
•••
You can also use <div> tag to center whole webpage in a website...as to add a constant value can cause problem on different resolutions...
 
0
•••
I will suggest you do stick to CSS instead of div tag to center the content of the site until you can not avoid it. Better performance :lol:
 
0
•••
CSS is used to style HTML tags (including div).

For future reference, the best way to do this is to set a fixed width to the div and then set the left and right margins to auto.

Code:
#wrapper { width: 1000px; margin-left: auto; margin-right: auto; }

Code:
<div id="wrapper">This div is centered</div>

(And yes, I know about CSS shorthand...just formatted it like that so it would be easier to understand for beginners.)
 
0
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back