Adding CSS directly to the page body
-
Adding CSS declarations within <style> tags to the page body is generally frowned on, but it’s potentially very useful, e.g. for styling elements added to the page using shortcodes. WordPress itself does this with its [gallery] shortcode.
I’ve never seen anyone else using this ability and so I’m wondering: are there any downsides? I know it means pages with older doctypes won’t validate, but what I really want to know is: are there any cases where it just won’t work?
Also, how, if at all, does the HTML5 doctype change things? Are <style> elements in the page body legitimate in HTML5?
If anyone has any thoughts on this, I’d love to hear them.
The topic ‘Adding CSS directly to the page body’ is closed to new replies.