How can I insert vertical blank space into an html

2019-02-08 05:26发布

I am writing a quiz in html and I would like to insert a consistent blank vertical space between questions (like one would use vspace{3 cm} in LaTeX).

For example:

<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>

Is there a straight forward way of doing this using just html and css?

3条回答
神经病院院长
2楼-- · 2019-02-08 05:58

Read up some on css, it's fun: http://www.w3.org/Style/Examples/007/units.en.html

<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>
查看更多
\"骚年 ilove
3楼-- · 2019-02-08 06:04

While the above answers are probably best for this situation, if you just want to do a one-off and don't want to bother with modifying other files, you can in-line the CSS.

<p style="margin-bottom:3cm;">This is the first question?</p>
查看更多
贪生不怕死
4楼-- · 2019-02-08 06:09

write it like this

p {
    padding-bottom: 3cm;
}

or

p {
    margin-bottom: 3cm;
}
查看更多
登录 后发表回答