Distortion Posted October 28, 2009 Report Share Posted October 28, 2009 (edited) On some websites, for example w3schools.com, when you make the browser window smaller the centered area where the content is jumps to the left.So there is more room for the website. When you press fullscreen again the website jumps back to the middle of your screen.How do I do that? Edited October 29, 2009 by Distortion Link to comment Share on other sites More sharing options...
Ingolme Posted October 28, 2009 Report Share Posted October 28, 2009 (edited) If the content has fixed width and is centered, it will do that.Try this and see how it works: html,body { margin: 0; padding: 0; text-align: center;}#content { width: 960px; height: 200px; margin: 0 auto; text-align: left; border: 1px solid black;} <div id="content">Some content</div> Edited October 28, 2009 by Ingolme Link to comment Share on other sites More sharing options...
Distortion Posted October 29, 2009 Author Report Share Posted October 29, 2009 Thanks, I always worked with percentages, but this is way better! Link to comment Share on other sites More sharing options...
chibineku Posted October 29, 2009 Report Share Posted October 29, 2009 You can do it with percentages, too. If you want the body to be 80%, you just give it margin-left 10% (half the remainder), or just margin: 0 auto should work, too. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now