如何删除我在CSS中的上边距?

时间:2015-10-20 22:20:22

标签: html html5 css3

我尝试了几乎所有东西来摆脱上边距我使用normalized.css重置,通用选择器重置,HTML和身体重置边距为0.

HTML:

<!DOCTYPE html>
<html lang="en">

<head>
  <title>index</title>
  <link href='https://fonts.googleapis.com/css?family=Orbitron|Lato:400,700' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" type="text/css" href="main.css">
  <link rel="stylesheet" type="text/css" href="normalize.css">
  <!--[if IE]>
            <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
</head>

<body>
  <header>
    <div class="content-area">
      <div class="text-logo">
        <h1>Peacon<span>TT</span></h1>
      </div>
    </div>
  </header>
</body>

</html>

CSS:

html {
  margin: 0;
  padding: 0;
}
header {
  width: 100%;
  height: 70px;
  background-color: #586f7c;
}
.content-area {
  width: 1000px;
  margin: 0 auto;
}
.text-logo {
  font-family: "orbitron", Arial, Helvetica, sans-serif;
  font-weight: 100;
  color: #ffffff;
}

1 个答案:

答案 0 :(得分:0)

您可以将margin元素的h1属性设置为0以实现目标:

h1 {
  margin: 0;
}