Posted by Marty Dickinson on May 25, 2009
Here are 5 ways I’ve found so far for adding line breaks into WordPress posts and pages. WordPress is widely known for handling some of the most complex HTML issues and making them easy for even the most novice and non-technical. But, there are a few quirky things about WordPress that should be simple and are still tough to accomplish. One of those is how to add line breaks to WordPress posts and pages.
If you’re in Visual view while adding a new post, for example, you could start typing away and just hit enter. Many times that will work. However, when you add an image in your post, and the image isn’t wide enough to force your words to the next line, you might want to add a blank line. Often, the enter key will not help in this situation.
Or, if you use a headline, such as an <h> tag, how can you get a space between the H tag and your text?
So, this post is going to be an ongoing listing as I hear more options about how to add line spacing between one section and the next.
1. style=”margin-bottom: 1em” – This tag can be used inside any tag or such as <p> or <h>.
1em stands for 1 line spacing. So, if you want 5 lines of blank space, just make your code <h3 style=”margin-bottom: 5em”>
2. style=”clear: left;” – When you need to get text below an image, you can always use the image settings to manage how text surrounds images. But, HTML can have a mind of its own. So, if you try the settings in your image manager and still text is wrapping to the right or left of the image, use the text or paragraph here <p style=”clear: left;”>
3. css file – For either of these, you could make the line spacing automatic every time you add an tag or text at the bottom of an image. These statements would need to be included into your css file.
4. Disable WPAUTOP – Using this feature would completely disable any automatic formatting of paragraph breaks or line breaks. Programmers love this idea because it gives them full control over HTML code appearance. The drawback is that you have to manually insert any paragraph or line breaks or your paragraphs will just run together into a big mess or words. Here’s a link for how to disable WPAUTOP
5. Add TinyMCE Advanced plugin – This plugin works for some and not for others. So, it’s just one of those things you have to try if you have WordPress version 2.7 or higher. Once installed, go into the “settings” area for that plugin and check a box that stops WordPress from stripping your <p> and <br/> commands. Search your WordPress plugin directory for a free download of TinyMCE Advanced.
6. Add Blank Image – A rather old-school way of adding your own spacing would be having a transparent image the width of your post page and the height being the desired space you want between your two lines. Use this method if the others don’t work.
Have other methods for adding line breaks to WordPress posts? Enter your solution in comments.
I will be adding more options as I find more.
Click a Star to Rate This Post:
Tell Others About This Post:
Email This Post to a Friend