Created
January 5, 2012 20:59
-
-
Save maxfell/1567256 to your computer and use it in GitHub Desktop.
Art Directed posts in tumblr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Make sure to load the injectCSS() function when the body is loading --> | |
<body onload="injectCSS();"> | |
FUN | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function injectCSS() { | |
var css = '/*THECSS*/'; | |
if ('\v' == 'v') /* ie only */ | |
{ | |
document.createStyleSheet().cssText = css; | |
} else { | |
var style = document.createElement('STYLE'); | |
style.type = 'text/css'; | |
style.innerHTML = css; | |
document.getElementsByTagName('HEAD')[0].appendChild(style); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was looking for a way to make Art Directed posts in tumblr. Then I found out that it's possible to embed HTML-Tags in Tumblr post. This is the last missing piece to inject CSS-Stylesheets into the page.
Make sure to call the
injectCSS();
function when the page is ready.