如何在HTML文档中插入垂直空格



我正在用HTML编写一个测验,我想在问题之间插入一个一致的垂直空格(就像在LaTeX中使用vspace{3 cm}一样)。

例如:

<html>
  <body>
    <p>
     This is the first question?
      <!-- This is where I want about 3 cm of space -->
    </p>
    <p>
     This is the second question?
     <!-- This is where I want about 3 cm of space -->
    </p>
  </body>
</html>

有没有一种只使用HTML和CSS的简单方法?

如何在HTML文档中插入垂直空格?

阅读一些CSS。很有趣:CSS:em,px,pt,cm,in…

<style>
  .bottom-three {
     margin-bottom: 3cm;
  }
</style>

<p class="bottom-three">
   This is the first question?
</p>
<p class="bottom-three">
   This is the second question?
</p>

虽然前面的答案可能最适合这种情况,但如果你只想一次性完成,而不想修改其他文件,你可以内联CSS。

<p style="margin-bottom:3cm;">This is the first question?</p>

我总是用这个廉价的词来表示垂直空间。

    <p>Q1</p>
    <br>
    <p>Q2</p>

这样写:

p {
    padding-bottom: 3cm;
}

p {
    margin-bottom: 3cm;
}

最新更新