Richard C
Richard C

Reputation: 411

HTML 100% width wider than page

For some reason, I can't make a webpage be exactly 100% width, it always seems to have a scroll bar. I've even gone back to basics and can't work it out, so hopefully its just me being daft!

Can someone take a look please

* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  background-color: #393939;
  font-family: Arial, sans-serif;
  height: 100%;
  width: 100%;
  color: #f2f2f2;
}
Hello World

Upvotes: 0

Views: 97

Answers (1)

Ori Drori
Ori Drori

Reputation: 191946

Clear the margins on the body using margin: 0;.

* {
    box-sizing: border-box;
}

html {
  height: 100%;
}

body {
    background-color: #393939;
    font-family: Arial, sans-serif;
    height: 100%;
    width: 100%;
    color: #f2f2f2;
    margin: 0;
}

Upvotes: 2

Related Questions