How to alter paragraph spacing in WordPress

This topic contains 1 reply, has 2 voices, and was last updated by  Sebastian 3 weeks, 2 days ago.

Author Posts

trailertrash

Hi Sebastian

I’m learning CSS with daily practice but need help now with a WordPress website using the Kadence theme.

As you know, WP automatically adds a line of white space after each paragraph. To my mind, that’s readable but aesthetically too much for long-form articles, and way too much if a paragraph happens to consist of just one short sentence. For instance, my two questions in this case.

What element or other item should I select?

What code should I add?

A few words swimming in 10 lines of white space, ugh. WordPress and Kadence both say they’ll probably resolve this issue in updates but I need a solution now. Any help much appreciated.

Thanks
Mike


Sebastian

Hey Mike,

Could you send me a link to a page that displays this behaviour please? I would need to check the HTML to offer any CSS workarounds. But one though has occurred to me, if WordPress adds empty paragraphs to create the extra space, you could target them using the empty pseudo selector e.g.

p: :empty {
display: none;
}

Or just inside a parent container:

div.some-class p: :empty {
display: none;
}

Setting display to none would stop them taking up space on the page.

Cheers,
Sebastian

You must login or register to reply to this topic.