JSFiddle - React, Tailwind, and code Playground
by Oski Krawczyk
HTML
<section id="editable" contenteditable="true">
<h2>Go ahead, edit away!</h2>
<p>Here's a typical paragraph element</p>
<ol>
<li>and now a list</li>
<li>with only</li>
<li>three items</li>
</ol>
</section>
<div id="output"></div>
CSS
body {
font: normal 16px/20px "Helvetica Neue", Helvetica, sans-serif;
background: rgb(237, 237, 236);
margin: 0;
margin-top: 40px;
padding: 0;
}
section, header, footer {
display: block;
}
#wrapper {
width: 600px;
margin: 0 auto;
background: #fff url(../images/shade.jpg) repeat-x center bottom;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
border-top: 1px solid #fff;
padding-bottom: 76px;
}
h1 {
padding-top: 10px;
}
h2 {
font-size: 100%;
font-style: italic;
}
header,
article > *,
footer > * {
margin: 20px;
}
footer > * {
margin: 20px;
color: #999;
}
#status {
padding: 5px;
color: #fff;
background: #ccc;
}
#status.fail {
background: #c00;
}
#status.success {
background: #0c0;
}
#status.offline {
background: #c00;
}
#status.online {
background: #0c0;
}
/*footer #built:hover:after {
content: '...quickly';
}
*/
[contenteditable]:hover:not(:focus) {
outline: 1px dotted #ccc;
}
abbr {
border-bottom: 0;
}
abbr[title] {
border-bottom: 1px dotted #ccc;
}
li {
margin-bottom: 10px;
}
#promo {
font-size: 90%;
background: #333 url(../images/learn-js.jpg) no-repeat left center;
display: block;
color: #efefef;
text-decoration: none;
cursor: pointer;
padding: 0px 20px 0px 260px;
border: 5px solid #006;
height: 160px;
}
#promo:hover {
border-color: #00f;
}
#ih5 {
font-size: 90%;
background: #442C0D url(../images/ih5.jpg) no-repeat left center;
display: block;
color: #F7FCE4;
text-decoration: none;
cursor: pointer;
padding: 1px 20px 1px 260px;
border: 5px solid #904200;
}
#ih5:hover {
border-color: #CF6D3B;
}
#ffad section {
padding: 20px;
}
#ffad p {
margin: 10px 10px 10px 100px;
}
#ffad img {
border: 0;
float: left;
display: block;
margin: 14px 14px 0;
}
#ffad .definition {
font-style: italic;
font-family: Georgia,Palatino,Palatino Linotype,Times,Times New Roman,serif;
}
#ffad .url {
text-decoration:...
JavaScript
var ino = document.id('editable');
var out = document.id('output');
ino.addEvents({
keydown: function(){
out.set('text', ino.get('html'));
}
});