Validating in-valid CSS

Ever had it where your stylesheet contains code that doesn’t validate with the W3C standards…. Yet there’s not an easy way round it? For example ‘opacity’….. This code adds an...

Ever had it where your stylesheet contains code that doesn’t validate with the W3C standards…. Yet there’s not an easy way round it? For example ‘opacity’…..

This code adds an additional stylesheet after the page has loaded, allowing you to pop the in-valid code whilst achieving a valid mark from W3C…

if (document && document.getElementsByTagName) {
    var head = document.getElementsByTagName('head')[0];
    var link = document.createElement('link');
    link.type = 'text/css';
    link.rel = 'stylesheet';
    link.href = 'css/invalid_styles.css';
    head.appendChild(link);
}

Related posts:

  1. JavaScript Quick Syntax Check
  2. JavaScript Dot Operator List
  3. Adding jQuery to your page
  4. Javascript not validating?
  5. Create getElementsByClassName() function for use in IE

This post has had 17 views