Jump to content

[solved] Aligning Whole Website.


Distortion
 Share

Recommended Posts

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 by Distortion
Link to comment
Share on other sites

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 by Ingolme
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...