为什么我的标题开始这么低?

时间:2016-05-25 00:30:30

标签: html css

它从顶部开始像20px并且没有与顶部对齐。如果我做margin-top:-15px;然后一切都随着它移动,就像文本一样,它看起来很像,文本将更多地显示在顶部。这是我的css代码:

body {
    background-color: #1a1a1a;    
}

header, h1 {
    text-align: center;
    font-family: CGF Locust Resistance;
    font-size: 50px;
    color: lightgray;
    -webkit-text-stroke: 1.5px black;



}

header {
    margin: 0;
    padding: 0;
    height: 100px;
    border-bottom: 0.5px solid #b3b3b3;
    background-image: url(omen.png);
    background-repeat: no-repeat;
    background-position: center;

}

nav {
    position: relative;
    top: -5px;
    margin: auto;
    padding: 0;
    list-style: none;
    width: 100%;
    text-align: center;
    border-bottom: 0.5px solid #b3b3b3;

}
nav ul li {
    display: inline;
    color: white;
    font-family: CGF Locust Resistance;
    font-size: 12.5px;
    padding: 20px;
}

.red {
    color: red;
}

这是html

<!DOCTYPE html>

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="index.css">
        <meta charset="UTF-8">
        <title>Gears of War</title>
    </head>

    <header>
        <h1>GEARS OF WAR</h1>
    </header>

    <nav>
        <ul>
            <li>Gears of War <span class="red">1</span></li>
            <li>Gears of War <span class="red">2</span></li>
            <li>Gears of War <span class="red">3</span></li>
            <li>Gears of War <span class="red">Judgment</span></li>
            <li>Gears of War <span class="red">4</span></li>
        </ul>
    </nav>
    <body>


    </body>
</html>

1 个答案:

答案 0 :(得分:1)

设置保证金:0到h1。你可以为它添加填充样式。

相关问题