Is there an easy way to reload css without reloading the page?

Possibly not applicable for your situation, but here’s the jQuery function I use for reloading external stylesheets: /** * Forces a reload of all stylesheets by appending a unique query string * to each stylesheet URL. */ function reloadStylesheets() { var queryString = ‘?reload=’ + new Date().getTime(); $(‘link[rel=”stylesheet”]’).each(function () { this.href = this.href.replace(/\?.*|$/, queryString); }); … Read more

Can you link to a CSS file from an email?

Forget efficient. Forget smart. Forget maintainable. This is HTML mail we’re talking about. HTML mail and Webmail clients are extremely limited, partly for security reasons but mainly because they’re just rubbish. External style sheets almost certainly won’t work. HTML-embedded style sheets probably won’t work. Inline style=”…” attribute on every damn element… has a much better … Read more

Is type=”text/css” necessary in a tag?

It’s not required with the HTML5 spec, but for older versions of HTML is it required. Html 4 W3.org spec http://www.w3.org/TR/html40/struct/links.html#edef-LINK http://www.w3.org/TR/html40/present/styles.html Type stands for The MIME type of the style sheet. The only supported value I have ever seen is Text/CSS, which is probably why HTML5 has dropped it. I imagine they had it … Read more

How to style SVG with external CSS?

Your main.css file would only have an effect on the content of the SVG if the SVG file is included inline in the HTML: https://developer.mozilla.org/en/docs/SVG_In_HTML_Introduction <html> <body> <svg version=”1.1″ id=”Layer_1″ xmlns=”http://www.w3.org/2000/svg” xmlns:xlink=”http://www.w3.org/1999/xlink” viewBox=”0 0 56.69 56.69″> <g> <path d=”M28.44…….”/> </g> </svg> </html> If you want to keep your SVG in files, the CSS needs to … Read more

Is it possible to alter a CSS stylesheet using JavaScript? (NOT the style of an object, but the stylesheet itself)

As of 2011 Yes you can, but you will be facing cross-browser compatibility issues: http://www.quirksmode.org/dom/changess.html As of 2016 Browser support has improved a lot (every browser is supported, including IE9+). The insertRule() method allows dynamic addition of rules to a stylesheet. With deleteRule(), you can remove existing rules from a stylesheet. Rules within a stylesheet … Read more