2

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?
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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