删除两个div之间的空格

时间:2015-01-29 07:28:04

标签: html css

如何删除headerwrapper div之间的空白区域。

这是DEMO fiddle。 这是HTML代码:

 <div id="container">
    <div id="header">
        <div id="logo">
        </div>
        <div id="login">
            <h3>
                CLIENT LOGIN</h3>
            Username
            <input type='text' name='username' id='username'>
            <input type='button' name='login' value='Login' id='btnLogin'>
            <br />
            Password:
            <input type='password' name='password' id='password'>
            <input type='button' name='register' value='Register' id='btnRegister'>
        </div>
        <div id="navigation">
            <ul>
                <li class="active"><a href="#">Home</a></li>
                <li><a href="#">Profile</a></li>
                <li><a href="#">Contact</a></li>
                <li><a href="#">Group</a></li>
                <li><a href="#">Seminar</a></li>
            </ul>
        </div>
    </div>
    <div id="wrapper">
        <div id="contents">
            <div id="welcome">
                <h3>
                    Welcome to Somara</h3>
                <p>
                    It is a long established fact that a reader will be distracted by the readable content
                    of a page when looking at its layout.</p>
                <p>
                    There are many variations of passages of Lorem Ipsum available.</p>
            </div>
        </div>
    </div>
    <div id="footer">
    </div>
</div>

这是CSS代码:

    body
{
    width:100%;
    margin:0px;
}

#header
{
    width: 100%;
    background-color: #2c2520;
    min-height: 200px;
}
#login
{
    float: right;
    color: white;
}
#logo
{
    background-image: url('../img/logo.png');
    min-height: 191px;
    min-width: 230px;
    float: left;
    background-repeat: no-repeat;
}
#navigation
{
    padding-top: 158px;
    margin-right: -200px;
    float: right;
}
#navigation li
{
    display: inline;
    min-width: 100px;
    padding: 5px 5px 5px 5px;
}

#navigation a
{
    text-decoration: none;
    font-family: Tahoma, calibri;
    font-size: 15px;
    color: #f8f8f8;
}
.active
{
    background-color: #afaba5;
    color: black;
}

.inactive
{
    color: white;
    background-color: #392f2b;
}

#contents
{
    width: 950px;
    margin: 0px;
    min-height: 700px;


}

#wrapper
{
    width: 100%;
    margin: 0 auto;
    background-color: #39302b;
}


#intro1
{
    min-width: 30%;
    max-width: 35%;
    min-height: 250px;
    float: left;
    padding: 10px;
    padding-right: 50px;
    padding-left: 50px;
    color: #cdcdcd;
}

#welcome
{

}

#welcome h3, p
{
    font-family: Myriad Pro;
    color: white;
    text-align: center;
    font-weight: normal;
}

#welcome p
{
    color: #cdcdcd;
    font-size: 20px;
}

2 个答案:

答案 0 :(得分:1)


margin

中删除#welcome h3
#welcome h3, p {
font-family: Myriad Pro;
color: white;
text-align: center;
font-weight: normal;
margin: 0;
}

link

答案 1 :(得分:0)

  

你应该应用这个css风格

#welcome h3, p {
 font-family: Myriad Pro;
 color: white;
 text-align: center;
 font-weight: normal;
 margin-top: 0px;
}

请检查此链接 http://jsfiddle.net/mynameisvikram/ygvwL724/2/