What's that smell?

OCD: obsessive coding disorder

The manner in which post titles are set in this blog is to have a separate field for the title, which is then displayed within a heading block. I don't know how the likes of Wordpress do it, but I wouldn't be at all surprised if this is standard practice. Nothing to get excited about, for the most part anyway.

But there is one aspect that irritates my OCD.

Text can be styled with, among other approaches, the inline <span> element:

<p>This is some text, <span style="font-style: italic;">and this is italic</span></p>

Which gives us:

This is some text, and this is italic

But when a style is to be applied to all content of a block element, it's better to apply it to the block element tag, simply because it reduces the amount of code:

<p style="font-style: italic;">All of this text is italic</p>

All of this text is italic

So far, so good. But, when I have a title that is styled, what I end up with is:

<h1><span style="font-style: italic;">Title text</span></h1>

Title text

Whereas what I'd ideally prefer is this, which is far tidier:

<h1 style="font-style: italic;">Title text</h1>

Title text

This cleaner approach could be accommodated, I think, but not without some fairly extensive recoding and database editing. So, I have an itch and, while I could scratch it, my OCD is just going to have to defer to my inertia and live with the irritation.