forked from mdn/css-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d39a548
commit 821e9ed
Showing
3 changed files
with
115 additions
and
14 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var section = document.querySelector('section'); | ||
var editable = document.querySelector('.editable'); | ||
var textareaHTML = document.querySelector('.playable-html'); | ||
var textareaCSS = document.querySelector('.playable-css'); | ||
var reset = document.getElementById('reset'); | ||
var htmlCode = textareaHTML.value; | ||
var cssCode = textareaCSS.value; | ||
|
||
function fillCode() { | ||
editable.innerHTML = textareaCSS.value; | ||
section.innerHTML = textareaHTML.value; | ||
} | ||
|
||
reset.addEventListener('click', function () { | ||
textareaHTML.value = htmlCode; | ||
textareaCSS.value = cssCode; | ||
fillCode(); | ||
}); | ||
|
||
textareaHTML.addEventListener('input', fillCode); | ||
textareaCSS.addEventListener('input', fillCode); | ||
window.addEventListener('load', fillCode); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* Some default styling for cookbook examples */ | ||
/* | ||
rgb(53,43,34) | ||
rgb(75,70,74) | ||
rgb(95,97,110) | ||
rgb(137,151,188) | ||
rgb(160,178,226) | ||
*/ | ||
body { | ||
background-color: #fff; | ||
color: #333; | ||
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
/* styles for the editor */ | ||
|
||
.playable { | ||
font-family: monospace; | ||
display: block; | ||
margin-bottom: 10px; | ||
background-color: #F4F7F8; | ||
border: none; | ||
border-left: 6px solid #558ABB; | ||
color: #4D4E53; | ||
width: 90%; | ||
max-width: 700px; | ||
padding: 10px 10px 0px; | ||
font-size: 90%; | ||
} | ||
|
||
.playable-css { | ||
height: 80px; | ||
} | ||
|
||
.playable-html { | ||
height: 160px; | ||
} | ||
|
||
.playable-buttons { | ||
text-align: right; | ||
width: 90%; | ||
max-width: 700px; | ||
padding: 5px 10px 5px 26px; | ||
font-size: 100%; | ||
} | ||
|
||
.preview { | ||
width: 90%; | ||
max-width: 700px; | ||
border: 1px solid #4D4E53; | ||
border-radius: 2px; | ||
padding: 10px 14px 10px 10px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.preview input { | ||
display: block; | ||
margin: 5px; | ||
} |