So far, I have read and understood the following truths regarding web development:
- HTML for content
- CSS is for presentation
- JavaScript is for behavior.
This is usually normal and good, and I believe that when I strictly follow these recommendations and use external .css and .js files, this makes my site a lot more manageable. However, I think I have found a situation that violates this thought.
I have a custom forum system that I created for one of my sites. In addition to the usual formatting for such a system (links, images, bold italics and underlining, etc.) I allowed my users to set the formatting of their text, including color, font family and size. All this is stored in the forum message database as a formatting code, and then translated into the appropriate HTML when viewing the page. (A bit inefficient, technically I have to translate before saving, but in this way I can work on the system live.)
Due to the nature of this and other similar systems, I get a lot of tags floating around the resulting HTML code, which, it seems to me, is unofficially outdated since I have to use CSS for formatting. This violates rules 1 and 2, which state that HTML should not contain formatting information, preferring the information to be placed in a CSS document.
Is there a way to achieve dynamic formatting in CSS without including this information in the markup? It's worth it? Or, given the alleged limitations of the correct code, will I limit what my users can do to follow the “right” way to format my code?
code-formatting html css code-generation
Nicholas flynt
source share