Created
September 12, 2013 07:12
-
-
Save mojaray2k/6533883 to your computer and use it in GitHub Desktop.
The following code sample is an example of how to make inline style sheets editable in the browser like other elements.
This file contains 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
<!--editable-inline-stylesheet.html --> | |
<style type="text/css" id="regular-style-block"> | |
html{ | |
background-color:#222229; | |
position:relative; | |
} | |
body{ | |
font:14px/1.3 'Segoe UI', Arial, sans-serif; | |
color:#e4e4e9; | |
min-height:500px; | |
} | |
</style> |
This file contains 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
//To make the style block visible and editable, execute this code in your console: | |
$('#regular-style-block').css({'display':'block', 'white-space':'pre'}) | |
.attr('contentEditable',true); | |
/* | |
The changes you make to the stylesheet affect the page in real time. Recently this live-editing stopped working | |
in Chrome, so you will have to try it out in Firefox to see the results. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment