html - 这个特定 html 页面上方的空白是什么?

标签 html css

这里我的 div 上方有一个 ~68px 的间隙。给了什么?

.mast_head {
  background: rgba(35, 35, 163, 1);
  background: -moz-linear-gradient(top, rgba(35, 35, 163, 1) 0%, rgba(94, 12, 245, 1) 51%, rgba(112, 210, 245, 1) 100%);
  background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(35, 35, 163, 1)), color-stop(51%, rgba(94, 12, 245, 1)), color-stop(100%, rgba(112, 210, 245, 1)));
  background: -webkit-linear-gradient(top, rgba(35, 35, 163, 1) 0%, rgba(94, 12, 245, 1) 51%, rgba(112, 210, 245, 1) 100%);
  background: -o-linear-gradient(top, rgba(35, 35, 163, 1) 0%, rgba(94, 12, 245, 1) 51%, rgba(112, 210, 245, 1) 100%);
  background: -ms-linear-gradient(top, rgba(35, 35, 163, 1) 0%, rgba(94, 12, 245, 1) 51%, rgba(112, 210, 245, 1) 100%);
  background: linear-gradient(to bottom, rgba(35, 35, 163, 1) 0%, rgba(94, 12, 245, 1) 51%, rgba(112, 210, 245, 1) 100%);
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#2323a3', endColorstr='#70d2f5', GradientType=0);
  height: 40vw;
  width: 100%;
  margin: 0;
  padding: 0;
  text-align: center;
}
body {
  margin: 0;
  padding: 0;
  background-color: green;
}
<div class="mast_head">
  <p style="font-family: 'Roboto', sans-serif;font-size:5vw;color:white;line-height:0;position: relative;
  top: 50%;">
    Text 1
  </p>
  <p style="font-family: 'Work Sans', sans-serif;font-size:2vw;color:rgba(255,255,255,.5);line-height:0;position: relative;
  top: 50%;">
    Text 2
  </p>
  <div style="top:-50;font-family: 'Biryani', sans-serif;color:white;">
    <div style="display:inline-block;">
      Bla1
    </div>
    <div style="display:inline-block;">
      Bla2
    </div>
    <div style="display:inline-block;">
      Bla3
    </div>
  </div>
</div>

最佳答案

编辑---

<p style="font-family: 'Roboto', sans-serif;font-size:5vw;color:white;line height:0;position: relative; top: 50%; display:inline-block;">

它是您的内联字体大小。使您的 P 标签内联 block 。或者改用 em 或 pt。

关于html - 这个特定 html 页面上方的空白是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36704584/

相关文章:

javascript - 单击时 HTML/Javascript/Bootstrap 无法隐藏按钮

javascript - 如何从 &lt;iframe&gt; 中删除 youtube 嵌入视频的黑边?

html - 列表项中的 img,其中包含文本和文本动画

python - django 静态文件 - 不起作用

html - IE8 : weird border around HTML button element

javascript - 删除网格单元格之间的空间

javascript - 出于样式目的在内联元素中使用 encase javascript 是否是一种不好的做法?

javascript - 我创建了一个 jquery 轮播,并使用 if 条件来运行和停止轮播

javascript - 如何在没有canvas的情况下在html中手动绘制矩形?

html - 获取内容以清除响应图像