WordPress.org

Ready to get started?Download WordPress

Forums

Line Breaks in Posts (8 posts)

  1. albrad84
    Member
    Posted 7 years ago #

    I know this has been covered before, but I can't seem to find a definitive answer.

    In my posts, WordPress seems to automatically parse out extra line breaks that I would like to leave in so that I can space out parts of my post.

    Any suggestions?

  2. moshu
    Member
    Posted 7 years ago #

  3. albrad84
    Member
    Posted 7 years ago #

    Hence the "I know this has been covered before, but I can't seem to find a definitive answer."

    I already did that exact search, looked at all the resulting posts, and couldn't find an answer.

    And just to give some additional info, I have the latest version of WordPress and no plugins activated.

  4. albrad84
    Member
    Posted 7 years ago #

    I did a bit more research and found that adding &nbsp; multiple times within the text box, you can add extra spaces. Unfortunately, if you go back and edit a post or page, these are removed and you have to add them back in again. It also will not work in certain posts for some reason (might have something to do with <h1...> tags nearby).

    Pretty clunky and annoying if you ask me (especially since I'm going to have to explain this to several people), but I guess I'll live with it, unless someone has a better suggestion.

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    In my posts, WordPress seems to automatically parse out extra line breaks that I would like to leave in so that I can space out parts of my post.

    Any suggestions?

    Yeah. Don't use linebreaks to insert vertical space. That's semantically incorrect anyway, because XHTML doesn't have to respect whitespace. You need to define formatting explicitly, not implicitly.

    Instead, use proper XHTML and define margin-bottom: space for the paragraph on top, or margin-top: space for the paragraph below, depending on which paragraph the focus is on as far as the spacing goes.

    <p>This is my paragraph</p>
    <p style="margin-top: 5em">This one has an extra 5 lines of space above it</p>

  6. albrad84
    Member
    Posted 7 years ago #

    WordPress often strips out the < p > tags and leaves it only with text and <br/> tags. I can't really figure out why it does this sometimes but not always.

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Stop using the rich text editor and that should stop happening, I think. The TinyMCE editor mucks with the posts a lot more than the normal one does.

  8. baweibel
    Member
    Posted 7 years ago #

    I have found a solution. Tried everything suggested but to no avail. Formatting is correct upon initial post but editor strips br tags, &nbsp, etc. whenever the post is edited. That includes space between two photos that are clearly entered with the p tag. It also forces text to wrap around photos rather than lie above or below a photo, regardless of the align attribute used. I now enter the following code in the html view, wherever I want to force a line break: br clear="all" / (add the front less-than and end greater-than symbols). It works and the editor does not strip it out.

Topic Closed

This topic has been closed to new replies.

About this Topic