Maine Wordpress
Just another WordPress weblog

No-break spaces/line breaks in Wordpress

Wordpress | Posted April 14th, 2008

I’ve been so busy lately that I haven’t realized the many changes in Wordpress 2.3.2.  And now they’re playing with version 2.5, but there are changes that are causing complaints, so I won’t go into that.

Remember how you couldn’t get Wordpress to hold a no-break space even though you typed in the code? Well, there’s still some issues with that and to make it work is trial and error. You can try this: when using the built-in editor, click on the Show/Hide advanced tool icon, then select the Insert Custom Character icon. The first character is the no-break space.  That doesn’t always work. You could also go into the code view and add the code  which I will do now. 
Is there a graphic element in there (some themes won’t show it) ? This is what happens when you start messing with stuff and haven’t studied the CSS.  You see, I used the code tag above. And the code tag has styling in some of the themes. So, in some of these themes, you’ll see something in that space and in some you won’t. I can remove the graphic simply by going into the stylesheet, find the code tag and remove the borders.

The good thing is that this gives away the answer: CSS

NOTE: If you prefer to work in code, just turn off the wysiwyg editor and use code. 

BEST WAY: The best way to force spacing between paragraphs is to use CSS. After all, it’s CSS that is supposed to control the visual style, right? In the p tag, give it a bottom margin of 1em. This will add a bottom margin every time you start a new paragraph. You can play with that  and see how much space you like. Then you don’t have to think about adding code or ending up with weird stuff. This certainly makes formatting a blog much nicer. For example, if you view this post in theme Candidate 2, you’ll see what looks like line breaks after each paragraph. They’re not actually line breaks, it’s the bottom margin of the p tag! Since this isn’t exactly like a word processor, you have to think a little differently. A space is a space. The size of it can be determined by style, not by whether you use the enter key or shift enter. Wordpress automatically puts in a p tag every time you hit your Enter key, so think about what you want to have happen visually.

If you want to force double spaces for some reason, then you might have to create a new style for that and apply it to the paragraph.  If you want this sort of style control, you’ll have to get a bit familiar with CSS.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.