CSS in blog posts

I think I figured out how to deal with CSS in blog posts. Consider layout like the right-floated image in the previous post. If you View Source, you’ll see that the style declarations appear directly inline in the img tag. This is to ensure that the post renders correctly in news aggregators. This isn’t especially versatile because I can’t easily go back later and re-style the layout for all images, say if I want to change the padding or the border color. The usual way to handle this is assign a CSS class to the image and specify the class layout in a separate stylesheet. But this breaks newsreaders, which typically don’t download the extra style information. The solution? Use CSS classes for the web version but hardwire the style information when generating the RSS. I feel a WordPress plugin coming on…

One thought on “CSS in blog posts”

Comments are closed.