WordPress – Line break and paragraph problem and how to fix it?

WordPress removes empty lines between paragraphs. Paragraphs supposed to have an empty line so it will be easy to read by the web site vistor and looks neat. But you have to live with that restriction if you want to stay with WordPress.

What are line breaks?

Line breaks are what we get when we press ‘Shift+Enter’ on keyboard in WYSIWYG editor. So text will start in new line just below the previous line.

Example:

Line1
Line2
Line3

What are paragraphs?

Line breaks are what we get when we press ‘Enter’ once on keyboard in WYSIWYG editor. So text will start in new line after leaving an empty line.

Example:

Line1

Line2

Line3

How to fix this in WordPress?

Remember … WordPress DON’T REMOVE <p … /p> tags as such. It ONLY REMOVES the empty lines in between them. So we use this to fix our problem with paragraphs.

1. Login into your WP admin panel.

2. Go to Appearance > Editor > You will see style.css file in the file list on right side.

3. Locate <p> tag in your css file.

Add the following lines to it:

padding-top:1.0em;
padding-bottom:1.0em;

Example:

My p tag is like this:

.post p {
line-height: 1.5em;
margin: 0px 0px 7px 0px;
}

After adding those two lines, it will look like this:

.post p {
line-height: 1.5em;
margin: 0px 0px 7px 0px;
padding-top:1.0em;
padding-bottom:1.0em;
}

Save the file. That is it!

So all paragraphs get a space above and below but shift+enter leaves us with simple line break as we want.

NOTE:

Some times it is difficult to fine ‘p’ tag or you don’t want to change your css. Then add this at the end of your css file and save:

p {
padding-top:1.0em;
padding-bottom:1.0em;
}

Related Posts:

  • No Related Posts

9 comments

  1. Jan says:

    Finally, your solution helped me out a great deal! Thanks!

  2. bob jones says:

    Phew, thank you so much!

  3. scott says:

    The onlything that works for me, and doesn’t dissapear after switching to “visual” is adding:


  4. scott says:

    sorry try this again:

    adding the “strong” and “/strong” value between greater than less than

  5. Sarah says:

    Well, this makes sense but I still can’t get the paragraph breaks to work. I added

    p {
    padding-top:1.0em;
    padding-bottom:1.0em;
    }

    to the bottom of my css styles file and saved it, but nothing changed. Any suggestions? It’s a hassle hand coding every blog to include paragraph breaks. Do you think WP will ever fix this?

  6. You can try empty <div tag between paragraphs with your desired height.

  7. Junaid says:

    thanks for this.. helped me.. thanks.

  8. Aussie says:

    Thankyou, I would never have thought of that work-around. That paragraph problem had been bugging me for months.

  9. Parag says:

    Please help me !! The actual site on which I am working – http://www.rexnordindia.in is under construction, so I m providing you the link of my another site – http://latestpricelistindia.in/wp-content/uploads/2011/11/Sample.jpg I want the content alignment as shown in the link. I have tried P-tag but no avail. Help me !!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*