I have a website that gets updated through a WYSIWYG editor by people with very little HTML knowledge. The WYSIWYG exports table-based structure with old deprecated tags like "align" and "bgcolor" onto a site that is CSS driven so these attributes get overwritten.
For example, a black background is applied to a table in the WYSIWYG editor but once it goes live on the site, the background defaults back to none (default) because of the site's CSS reset.
Is there a way to account for these old tags the CSS is overwriting that I might not be seeing without getting rid of the reset CSS, creating additional CSS markup or upgrading the WYSIWYG tool?
If you must use ! important in your CSS, comment your usage so future code maintainers know why the declaration was marked important and know not to override it. But definitely, don't use ! important when writing plugins or frameworks that other developers will need to incorporate without being able to control.
An inline CSS is used to apply a unique style to a single HTML element. An inline CSS uses the style attribute of an HTML element.
Ideally, you shouldn't be using a WYSIWYG editor which generates table-based layouts and deprecated attributes — it's just bad semantics.
I'd suggest upgrading to a better editor, such as TinyMCE, since there's no way you can make attribute styling override your CSS rules.
You could use JavaScript to replace the bum-attributes with RegEx?
replace() - http://www.w3schools.com/jsref/jsref_replace.asp
RegEx - http://www.regular-expressions.info/tutorial.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With