Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make a header full screen (width) css

Tags:

css

I am trying to extend my header to cover the full page. http://dev.webgrowth.biz/ and I want it look like this one http://www.webgrowth.biz/ I have been trying everything for hours now. any help would be highly appreciated.

like image 613
Gunjack Avatar asked Sep 06 '11 23:09

Gunjack


People also ask

How do I make my header 100%?

You can remove the top margin on the nav or, instead of height: 100vh on the header, use height: calc(100vh - 50px) .

How do you make a section full width?

Making sections full-height and full-width can be done in two ways: Using viewport units ( vh and vw ) - May feel the most intuitive out of the two. In fact, the viewport units were introduced to do just these kinds of things. Using implicit units like percentages.


3 Answers

Live Demo

You can achieve the effect using a container element, then just set the containing elements margin to 0 auto and it will be centered.

Markup

<div id="header">
    <div id="headerContent">
        Header text
    </div>
</div>

CSS

#header{
    width:100%; 
    background: url(yourimage);
}
#headerContent{
    margin: 0 auto; width: 960px;
}
like image 182
Loktar Avatar answered Oct 14 '22 21:10

Loktar


#header {
margin: 0;
padding: 0;
width: 100%;
background: xxxx;
}

#header #content {
margin: 0px auto;
width: 800px; /* or whatever */
}

<div id="header">
<div id="content">
stuff here
</div>
</div>
like image 21
Rick Kukiela Avatar answered Oct 14 '22 21:10

Rick Kukiela


Just set the header width to be 100vw to make it full screen width and set the header height to be 100vh to make it full screen height

like image 40
Mohamed Saad Avatar answered Oct 14 '22 20:10

Mohamed Saad