Almost too easy...

How can I decrease the spacing between the lines generated by <p>?  I have something like

<p>Test line 1</p>
<p>Test 2</p>
<p>Three</p>

I want to decrease the spacing between the lines.  How can I do that?

Thanks
p021497Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
rafisternConnect With a Mentor Commented:
With style sheets:

<style>
p {margin-top:0.5em;}
</style>

equivalent to

<p style="margin-top:0.5em;">

would reduce the spacing to half a letter height. (This will only work on NS4+ and IE3+)

0
 
martinagCommented:
<BR>Test line 1
<BR>Test 2
<BR>Three

<P> is equal to <BR><BR>

Martin
0
 
ozoCommented:
or:

<p>Test line 1<font size=-4> </p>
<p> </font>Test 2<font size=-4>.</p>
<p></font>Three</p>
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
p021497Author Commented:
rafistern, can you please provide a brief example as to how to implement your solution?  I am rather confused.
0
 
martinagCommented:
Put this between <HEAD> and </HEAD>:
<style>
<!--
  p {margin-top:0.5em;}
// -->
</style>

That'll change all <p>'s in your document. If you just want to change a few, use this:
<p style="margin-top:0.5em;">
instead of just <p>

Martin
0
 
hualingCommented:
Please try this :


<html>
<head>
      <title>Untitled</title>
      </head>

<body>

That'll change all
<p style="margin-top:2em;">'s in your document. If you just want to change a few, use this:
<p style="margin-top:0.6em;">
instead of just
<p style="margin-top:0.1em;">
look this one

</body>
</html>

Hualing
0
 
rafisternCommented:
That's right, do what they said. Sorry I didn't get back to you but it was the middle of the night over here.
0
 
p021497Author Commented:
I have it working now.  But is there any way I can decrease the spacing even more?  I tried this:
<p style="margin-top:0.0001em;">

but that is not enough!  Can I decrease spacing even more?  I will post separate questions for everyone who contributed.
0
 
martinagCommented:
I don't know much about this, but you could try using "0em" and if that isn't enough, try negative values, ie. "-1em".

Martin
0
 
p021497Author Commented:
After further experimentation, I have found that -0.9999 works very well.  I have accepted rafistern's answer and have posted two more 25 point questions for Martin and Hualing.
0
All Courses

From novice to tech pro — start learning today.