Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My header is not fitting properly on the top of web page?

Tags:

html

css

I'm a beginner and I'm trying to fit my header on the top but it's not fitting. Here is screenshot:

enter image description here

Here is my source code:

<header style="height: 50px;background-color: rgb(26, 26, 26);">
    <div class="container"></div>
</header>

Can you please let me know, What's wrong here? Help would be appreciated.

like image 819
Baba guru Avatar asked Jun 23 '15 09:06

Baba guru


People also ask

How do I fix a header at the top of a page in CSS?

To create a fixed top menu, use position:fixed and top:0 .

How do I fix the header size in HTML?

To fix the position of the header in the webpage, use position: fixed, and to fix it at top use to top:0.


1 Answers

You need to add the following style in your css. There is default styles of browser which needs to overridden, in order to achieve the requirement.

html, body {
    margin : 0;
    padding : 0;
}
like image 184
Nikhil Aggarwal Avatar answered Oct 11 '22 08:10

Nikhil Aggarwal