} ------------ they said the code can center the layout. But what 50% refer to? half of the window? i barely understand what the padding value's meaning
body { is the equivalent to HTML's <body> tag. This is where you specify things like background color and page margins. If the main content area of your web page is 600px wide, you should create a seperate div for it. .main { width: 600px; }
If you're trying to center the main content area, you will need to add something like this: body { text-align: center' }
You won't use padding for centering. Padding is the equivalent to HTML's cellpadding property, which puts a gap in between the border of the container and its content.
But another question is about percentage value if we have a DIV in a container(width 500px,margin 0,padding 0),and we set padding-left:50%,did it equals to "padding-left:250px"?
The percentage uses the parent values yeah, dont know if there are any "if" to that rule . . . so dar i know that's how the percentage work. Actually you can make a simple test I think, change the padding to 250px, it should still look the same.