Topbar from the center?

I have a div that I use as the top bar with the code below:

#topbar {
    height: 40px;
    width: 100%;
    background-color: #336680;
    box-shadow: 0.1em 0.1em 0.1em;
    position: absolute;
    top: 0;
    padding: 0;
}

I try to do this across the entire screen, but for some reason it is disconnected from the center and does not cover the left side of the screen. How to fix it?

+3
source share
1 answer

Just add left:0. So that...

#topbar {
height: 40px;
width: 100%;
background-color: #336680;
box-shadow: 0.1em 0.1em 0.1em;
position: absolute;
top: 0;
padding: 0;
left:0;
}
+3
source

All Articles