My website is going to have a solid black background and a wide white strip down the middle where the content will be stored. Now what size should I make the strip instead of plugging random numbers? And how should I add it in CSS?

2 answers

First of all, I think this is a good question. When you decide what with you want your content in, you should take into consideration who is going to be viewing your website. Obviously, if you were targeting mobile devices, you would want something small. Otherwise, you will want a width that fits well on a majority of screen resolutions. Personally, I like 960 px. It fits well within a 1024 px resolution, and a lot of websites use that number.

Your CSS is simple. All you need is to have a <div> element in your html that will hold your content. Something like this:

Ok, Thats works but I have one more problem. I added it it works great but its hanging on the left. I tried adding `float: right;` but it goes to the right. I want it to be in the center? — shorty876 over 6 years ago

use margin:auto to centre the content div — danwellman over 6 years ago

Additionally, many designers use 'the golden ratio' to determine the relative sizes of different elements on a web page, see this excellent tutorial that describes it, along with some basic principles common to website layout and design