Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Div not 100% width of browser

Tags:

html

css

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

.header {
  position: relative;
  background-color: #088ed7;
  width: auto;
  height: 20px;
}
<div class="header">...</div>

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

like image 611
SaturnsEye Avatar asked Oct 04 '13 15:10

SaturnsEye


1 Answers

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

Add:

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

.header {
  margin: 0;
}

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

.header {
  margin: 0;
  position: relative;
  background-color: #088ed7;
  width: auto;
  height: 20px;
}
<div class="header">...</div>
like image 149
Paul Roub Avatar answered Sep 20 '22 14:09

Paul Roub