Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to overlap two divs

Tags:

html

css

styling

I'm designing a new website and I have come across a problem. The way I want my navigation bar to work is that it blends into the header (logo bar).

Here is what it currently looks like when coded:

enter image description here

Here is what I want it to look like:

enter image description here

Currently this is my CSS:

#header {
margin: 0px auto;
width: 900px;
height: 170px;
background: #000;
}

#navigation {
margin: 0px auto;
width: 920px;
height: 60px;
background: url('images/nav.png');
}

And my HTML:

        <div id="header">

        </div>


        <div id="navigation">

        </div>
like image 417
Duncan Palmer Avatar asked Dec 16 '22 00:12

Duncan Palmer


2 Answers

you can write like this:

#header {
margin: 0 auto;
margin-bottom:-30px;
width: 900px;
height: 170px;
background: #000;
}
like image 94
sandeep Avatar answered Jan 08 '23 12:01

sandeep


A negative margin or position: absolute will fix your problem.

like image 24
Rui Carneiro Avatar answered Jan 08 '23 13:01

Rui Carneiro