Workaround for CSS reset overwriting deprecated HTML attributes (e.g. align, bgcolor)?
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?
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
No. CSS explicitly overrides any presentational markup in the document.
You'll have to do some work to get it going,
The best option IMO is to style the classes for these elements in CSS and allow them to be overridden.
精彩评论