Avatar of dlearman1
dlearman1
Flag for United States of America asked on

How to decrease the whitespace between two blocks of text

Given 2 text blocks like this

<p>First text block<br>
second line</p>
<p>Second text block<br>
second line</p>

What CSS would result in the text blocks separated by less than the default paragraph spacing without changing the line-height inside the text blocks?

I've tried using styled <hr>, which works but only to increase the spacing. I've also experimented with fractional line heights. To avoid changing the interior line-heights I've tried enclosing the first word of the second block in span tags.

I'm hoping someone has a working solution.
CSS

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon
Julian Hansen

You want to look at the margin style
Try the following styles to see the effect (Big margin)
p {
   margin: 50px 0;
}

Open in new window

Or small margin
p {
   margin: 5px 0;
}

Open in new window

dlearman1

ASKER
Julian,

I believe this would change the spacing on all lines of text in a p tag, not just the first line in each paragraph.
ASKER CERTIFIED SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23