Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have this meticulous problem,

  1. I have a test html page whose body content is a single div tag.
  2. I made the width and height of the div tag to 100% and colored the background red.

And I get irritated by the white space border around the div tag. So my questions are:

  1. What is the white space border around that div element?
  2. How do I manipulate it OR get rid of it?
share|improve this question

1 Answer 1

up vote 4 down vote accepted

You can use CSS to remove it.

Before and After.

Just inserted

body, html {
    border: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    width: 100%;
}

into the CSS. You have to set the height (and occasionally on mobile devices the width too) to 100% in order for the div to follow suit. Then changing the border, margin and padding to 0 (no px, etc) has stood me well for years. Although the floor is open to alternatives.

share|improve this answer
    
i love you! Thanks! –  Richeve Bebedor Apr 19 '11 at 5:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.