NameSilo

CSS Alignment problem

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

wistow

Established Member
Impact
0
Hi

I have been using css since last sunday, and I have learnt it pretty quick.

The problem I am having is that I have a website layout where the content is in a fixed sized layer of 754 pixels. When designing on my monitor which is 1024x768 i give it a 12% indent from the left side of the page and it looks fine as it is centrally aligned, BUT when I test it in 800x600 mode it is all aligned to the right of the page and I am wanting it aligned in the centre of the page on both resolutions.

Do you have any ideas how I could do this? If it is very obvious i am sorry but remember i'm just a newbie! :)

Kind Regards,

Craig Wistow
HitSnapper.com
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
I am new to css too, but the way I center the layer is:

#layer {
position:absolute;
left:50%;
width:754px;
margin-left: -377px; }

position left:50% will align the left side of your layer with the center of any browser window and margin left (377 is half of your layer width) will move the left side -377 px to the left from the center. That way your layer will be always centered.

Good luck, hope it will help

Radka
 
0
Close
Thanks, that would work, but I cured the problem this morning :)

Thanks for the help though!

Kind Regards,

Craig
 
0
Close
Did you find different solution?

Radka
 
0
Close
Yes i used the following:

body{
text-align-center; background-color: #cccccc
}

#header{
width: 754px;
text-align: left;
margin-left: auto;
margin-right: auto;
}

Kind Regards,

Craig
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back