SaturnsEye SaturnsEye - 27 days ago 13
CSS Question

Div not 100% width of browser

My div will not stretch the full width of the browser, it stops short on both ends by about 10px.

<div class="header">...</div>

.header {
position:relative;
background-color:#088ed7;
width:auto;
height:20px;
}


I've tried both
auto
and
100%
but still the same outcome

Answer

It's likely the page's margin/padding.

Add:

html, body {
  padding: 0;
  margin: 0;
}

.header {
  margin: 0;
}