Skip to content

Instantly share code, notes, and snippets.

@peterwilsoncc
Last active December 14, 2015 23:39
Show Gist options
  • Select an option

  • Save peterwilsoncc/5167262 to your computer and use it in GitHub Desktop.

Select an option

Save peterwilsoncc/5167262 to your computer and use it in GitHub Desktop.
Base64 Encoded CSS
<html>
<head>
<link rel="stylesheet" href="style.css">
<noscript><link rel="stylesheet" href="base64images.css"></noscript>
</head>
<body>
<p> Hello World </p>
<script>
window.onload = function(){
//in real-world I'd do the event properly
var imgcss=document.createElement('link'),
before=document.getElementsByTagName('link')[0];
imgcss.href='base64images.css';
before.parentNode.insertBefore(before,imgcss)
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment