CSS center page on screen
Posted
by
Kostronor
on Stack Overflow
See other posts from Stack Overflow
or by Kostronor
Published on 2013-10-17T15:44:31Z
Indexed on
2013/10/17
15:55 UTC
Read the original article
Hit count: 74
//sorry for the bad formating, i am on my phone...
When someone asks how to center a page, then the response is like:
margin-left:50%;
left:(-1/2 width);
I used this code on a site with a width of 1000px,so it comes to screens, where this site does not fit. Now the site gets centered on the smaller screen and gets equaly pushet to left and right.
So lets say, our screen is 600px wide:
200px are left
600px are on screen
200px are right
You can scroll to the right, but the pixels on the left are unreachable...
How can i solve this to control, how much of my site gets dragged to the left in case of smaller screens? This is especially important for mobile phones...
© Stack Overflow or respective owner