How can I insert vertical blank space into an html document?

182,627

Solution 1

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>

Solution 2

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>

Solution 3

i always use this cheap word for vertical spaces.

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

Solution 4

write it like this

p {
    padding-bottom: 3cm;
}

or

p {
    margin-bottom: 3cm;
}
Share:
182,627

Related videos on Youtube

DQdlM
Author by

DQdlM

Updated on July 09, 2022

Comments

  • DQdlM
    DQdlM almost 2 years

    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?

  • DQdlM
    DQdlM over 12 years
    thanks, that was the clue I needed - I actually created a class for quiz questions and then put each question inside <div>. works great.
  • DQdlM
    DQdlM over 12 years
    thanks, that helps a lot. I am still learning to think "html" as I switch away from LaTeX.
  • scala_is_awesome
    scala_is_awesome over 11 years
    Off topic, but I'm curious why you seem to feel HTML is better for this purpose than LaTeX?
  • DQdlM
    DQdlM about 11 years
    @scala_is_awesome I know this comment is very very old but I just happened upon it so in case you are still curious... I use LaTeX a lot for my class materials but I have started using html more and more for things that do not need the high polish of LaTeX and will go up on my class webpage. They are a bit easier to edit on the fly and are easier to share in an editable format for Word-only users, since Word can parse html.
  • taranaki
    taranaki almost 3 years
    simple and quick