Distortion Posted October 28, 2009 Share Posted October 28, 2009 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? Link to comment Share on other sites More sharing options...
Ingolme Posted October 28, 2009 Share Posted October 28, 2009 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> Link to comment Share on other sites More sharing options...
Distortion Posted October 29, 2009 Author 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 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
Archived
This topic is now archived and is closed to further replies.