简体   繁体   中英

HTML CSS - Making top bar and bottom bar reach the edges

This is my HTML just for top part.

<div id="headerContainer">
    <!--Logo-->
    <img src="pic_mountain.jpg" alt="Mountain View" id="logo">
    <span id="pageName">Untitled Page Name</span>
</div>

This is the CSS just for top part.

#navContainer{top: 0;
    float: left;
    margin-top: 20px;
    height:auto;
    width:auto;

    margin-left: -10px;
}

This code almost works, but it leaves a gap on the left side can I please have help, how do I fit the gap?

I only want to use CSS and HTML, not any weird external stuff.

Try to add

body {
  margin: 0;
  padding: 0;
} 

to your CSS File, this should close the Gap. If this is not what you desired feel free to write a comment :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM