Grow your CSS skills. Land your dream job.

Adding Extra Spaces Between Paragraphs in WordPress

  • # August 13, 2010 at 11:51 am

    Hey Guys,

    I have paragraphs set up in my theme correctly.
    p { margin: 0 0 1.5em 0; }

    It works well for the most part. However there are occasional instances where my client would like to double the space between two paragraphs – effectively upping the bottom margin to 3em.

    Simply hitting enter twice does not work. WP removes the extra empty paragraph.

    What can I do?

    # August 13, 2010 at 12:22 pm

    Did you try adding a paragraph with only a non-breaking space?

    Code:
    <p>&nbsp;</p>
    # August 13, 2010 at 12:47 pm

    There must be a reason why the client wants to do that. Maybe it’s separating two different thoughts? It sounds like there should be another header added in there, like this:

    <p>alsdkfj</p>

    <h2>Secondary Header</h2>

    <p>aksldjfk</p>

    That way you can style a top margin on the <h2>.

    # August 13, 2010 at 1:28 pm

    betzster: I can’t use html to fix it because the client needs to be able to do it – and they don’t know any code. I appreciate the thought though!

    TheDoc: I completely agree about separating thoughts with headings etc – but unfortunately thats not going to fly with her. She’s bringing over copy from an old site and she had stuff separated in odd fashions – and she wants to do it again. She’s frustrated that when she saves, the WP filter is removing her spacing.

    I’ve been trying to walk her through using hard returns vs soft returns and she’s got it – but now the only issue remaining is this double-space issue.

    # August 13, 2010 at 3:38 pm

    Is WordPress stripping <br>s as well? I was under the impression it didn’t do that.

    # August 13, 2010 at 3:46 pm

    I can’t remember what the name of the filter is that strips out extra paragraphs, but if you find that you can remove the filter with a function. The problem then is that you would probably want to also add a new filter because that one does all kinds of other sanitizing as well.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".