This is in response to christine, who has asked elsewhere how to intent the first lines of her paragraphs in WordPress 2.5; my response in the comments there was less than satisfactory due to the stripping of my code examples and so on, so here is a slightly more formal tutorial.
As you’re reading this, notice that (unless I sometime in the future change the style ;-) the paragraphs have no intention on their first lines; open most any book, though, and you’ll see that paragraphs are generally indented. I’m not entirely sure what the typographical reasons behind line indenting in aside from simple aesthetics (in other words, it just looks better), but that isn’t the question I’m here to answer. So, onward: How can we indent the first lines in WordPress?
Good question. And it’s one easily answered, I think. Actually, there are two answers. The first is a stopgap solution that certainly works but it’s less than ideal for a variety of reasons; the biggest of these reasons is that the solution involves inline styling, which is just bad semantics. The second solution is a more permanent, much more flexible solution which involves adding the indention code to your blog’s design’s style sheet. The big advantage of the second solution over the first is that if you ever want to change the style of the indented paragraphs, you only have to change the code in one place (the style sheet) rather than in every post wherein you used indented paragraphs.
Did you notice the previous paragraph was indented? Thanks to the stopgap solution, I was able to quickly add the indent in to show off what we’re talking about here. Now, what is that solution?
Well, I usually write using the “Visual” tab of the editor in WordPress 2.5; to do my text indention, I had to switch over to the “HTML” tab briefly. I had already typed my paragraph, so it was simply a matter of wrapping sufficiently styled P tags around it, such that the final result looks like this:
<p style="text-indent: 2em;">Good question. And it's one easily answered, I think. Actually, there are two answers. The first is a stopgap solution that certainly works but it's less than ideal for a variety of reasons; the biggest of these reasons is that the solution involves inline styling, which is just bad semantics. The second solution is a more permanent, much more flexible solution which involves adding the indention code to your blog's design's style sheet. The big advantage of the second solution over the first is that if you ever want to change the style of the indented paragraphs, you only have to change the code in one place (the style sheet) rather than in every post wherein you used indented paragraphs.</p>
That’s all there is to it! Simply encase your paragraphs in styled P tags as I have done above, and your paragraphs will indent on the first lines. Nice and simple!
If, however, you want a more permanent solution, you’ll want to open up your design’s style sheet, usually named style.css. Your theme may support a custom.css or some other upgrade-proof style sheet that you can tweak without worrying about future theme upgrades; if it does, edit it rather than style.css.
Then, on a new line at the bottom, insert code similar to this — you can format it similarly to the rest of the code in the file if you so choose:
p {
text-indent: 2em;
}
After saving that file and refreshing your browser cache, you should notice that all P tags are now indented on your site. If this causes indention in places you don’t want, you’ll want to be more specific in your styling; isolate the name of the container which holds your post content and add it to the style so that only paragraphs within post content are styled. For WordPress’ default Kubrick theme, you could use this code:
.entry p {
text-indent: 2em;
}
You’re encouraged to try your own variations; if you break the style, all you have to do is remove that bit of styling to revert your changes!
And if anyone needs any more help (especially you, christine), just drop a comment.