简体   繁体   English

为什么我的div之间存在差距?

[英]Why is there a gap between my divs?

I'm sure one line of code will change this, but can anyone tell me why there is a gap between my divs for "About" and "Latest"? 我敢肯定,一行代码会改变这一点,但是谁能告诉我为什么我的div之间存在关于“关于”和“最新”的空白? I've put margin and padding to 0 too many places already. 我已经将margin和padding设置为0太多了。 Thanks: 谢谢:

http://jsfiddle.net/PfdRE/ http://jsfiddle.net/PfdRE/

HTML: HTML:

<body>
<div id="header" border="0">
    <div class="header_logo"><img src="images/logo.png" height="100px" alt="Ashley Lincoln Designs"></div>
    <div class="header_button"><span>Contact</span></div>
    <div class="header_button"><span>Archive</span></div>
    <div class="header_button"><span>Latest</span></div>
    <div class="header_button"><span>About</span></div>
</div>
//rest of code...

CSS: CSS:

{
    margin: 0;
    padding: 0;
}
body {
    background-color: #174C4F;
    margin: 0;
    padding: 0;
}
#header {
    width: 100%;
    height: 100px;
    margin: 0;
    padding: 0;
    background-color: #F5E9BE;
    color: #207178;
}
.header_logo {
    height: 100px;
    margin: 0 auto;
    padding: 0;
    color: #207178;
    font-family: "Verdana", Verdana, sans-serif;
    font-size: 20px;
    text-align: center;
    text-transform:uppercase;
    text-indent: 0px;
    display:inline-block;
    background-color: #F5E9BE;
    float: left;
    position:absolute;
    left:75px;
}
.header_button {
    width: 125px;
    margin: 0 auto;
    padding: 0;
    color: #207178;
    font-family: "Verdana", Verdana, sans-serif;
    font-size: 20px;
    text-align: center;
    text-transform:uppercase;
    text-indent: 0px;
    display:inline-block;
    background-color: #F5E9BE;
    float: right;
    position:relative;
    right:75px;
}

在您的CSS类中。

display:inline-block

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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