Skip to content

Commit

Permalink
Adding in tidied up editable parts
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelandrew committed Aug 22, 2018
1 parent 842d72f commit 5802985
Show file tree
Hide file tree
Showing 9 changed files with 379 additions and 66 deletions.
51 changes: 43 additions & 8 deletions css-cookbook/center.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,66 @@
<title>CSS Cookbook: center an element</title>

<link rel="stylesheet" href="styles.css">

<style>
.container {
height: 200px;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid rgb(75, 70, 74);
border-radius: .5em;
}

.item {
width: 10em;
border: 2px solid rgb(95, 97, 110);
border-radius: .5em;
padding: 20px;
}
</style>

<style class="editable">
.container {
height: 200px;
display: flex;
align-items: center;
justify-content: center;
}

.item {
width: 10em;
}
</style>

</head>

<body>
<div class="container">
<div class="item">I am centered!</div>
<section class="preview">
<div class="container">
<div class="item">I am centered!</div>
</div>
</section>

<textarea class="playable playable-css">
.container {
height: 200px;
display: flex;
align-items: center;
justify-content: center;
}

.item {
width: 10em;
}
</textarea>

<textarea class="playable playable-html">
<div class="container">
<div class="item">I am centered!</div>
</div>
</textarea>


<div class="playable-buttons">
<input id="reset" type="button" value="Reset">
</div>
</body>
<script src="playable.js"></script>


</html>
66 changes: 55 additions & 11 deletions css-cookbook/columns-flexbox-wrapping.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,77 @@
border-radius: .5em;
padding: 20px 10px;
width: 500px;
}

.container>* {
padding: 10px;
border: 2px solid rgb(95, 97, 110);
border-radius: .5em;
}
</style>

<style class="editable">
.container {
display: flex;
flex-wrap: wrap;
}

.container>* {
margin: 0 10px;
flex: 1 1 200px;
padding: 10px;
border: 2px solid rgb(95, 97, 110);
border-radius: .5em;
}
</style>

</head>

<body>
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic.</p>
<section class="preview">
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic.</p>

<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p>

<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed
pea prairie turnip leek lentil turnip greens parsnip. Sea lettuce lettuce water chestnut eggplant winter
purslane fennel azuki bean earthnut pea sierra leone bologi leek soko chicory celtuce parsley jícama salsify.</p>
</div>
</section>

<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p>
<textarea class="playable playable-css">
.container {
display: flex;
flex-wrap: wrap;
}

.container>* {
margin: 0 10px;
flex: 1 1 200px;
}
</textarea>

<textarea class="playable playable-html">
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic.</p>

<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p>

<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado
daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach
carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin
onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi beetroot
carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p>

</div>
</textarea>

<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea
prairie turnip leek lentil turnip greens parsnip. Sea lettuce lettuce water chestnut eggplant winter purslane
fennel azuki bean earthnut pea sierra leone bologi leek soko chicory celtuce parsley jícama salsify.</p>
<div class="playable-buttons">
<input id="reset" type="button" value="Reset">
</div>
</body>
<script src="playable.js"></script>

</html>
78 changes: 60 additions & 18 deletions css-cookbook/columns-flexbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,80 @@
border: 2px solid rgb(75, 70, 74);
border-radius: .5em;
padding: 20px 10px;
display: flex;
}

.container>* {
margin: 0 10px;
padding: 10px;
border: 2px solid rgb(95, 97, 110);
border-radius: .5em;
}
</style>

<style class="editable">
.container {
display: flex;
}

.container>* {
margin: 0 10px;
flex: 1;
}
</style>

</head>

<body>
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic.</p>

<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p>

<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado
daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach
carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin
onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi beetroot
carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p>

<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea
prairie turnip leek lentil turnip greens parsnip. Sea lettuce lettuce water chestnut eggplant winter purslane
fennel azuki bean earthnut pea sierra leone bologi leek soko chicory celtuce parsley jícama salsify.</p>
<section class="preview">
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic.</p>

<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p>

<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado
daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach
carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin
onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi
beetroot carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper
artichoke.
</p>

</div>
</section>

<textarea class="playable playable-css">
.container {
display: flex;
}

.container>* {
margin: 0 10px;
flex: 1;
}
</textarea>

<textarea class="playable playable-html">
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic.</p>

<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p>

<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado
daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach
carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin
onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi beetroot
carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p>

</div>
</textarea>

<div class="playable-buttons">
<input id="reset" type="button" value="Reset">
</div>
</body>
<script src="playable.js"></script>

</html>
49 changes: 42 additions & 7 deletions css-cookbook/columns-multicol.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
border: 2px solid rgb(75, 70, 74);
border-radius: .5em;
padding: 20px;
}
</style>

<style class="editable">
.container {
column-width: 10em;
column-rule: 1px solid rgb(75, 70, 74);
}
Expand All @@ -22,23 +27,53 @@
</head>

<body>
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
<section class="preview">
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic.</p>

<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p>

<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado
daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach
carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin
onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi
beetroot carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper
artichoke.
</p>

</div>
</section>

<textarea class="playable playable-css">
.container {
column-width: 10em;
column-rule: 1px solid rgb(75, 70, 74);
}
</textarea>

<textarea class="playable playable-html">
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic.</p>

<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p>

<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado
<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado
daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach
carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin
onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi beetroot
carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p>

<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea
prairie turnip leek lentil turnip greens parsnip. Sea lettuce lettuce water chestnut eggplant winter purslane
fennel azuki bean earthnut pea sierra leone bologi leek soko chicory celtuce parsley jícama salsify.</p>
</div>
</textarea>

<div class="playable-buttons">
<input id="reset" type="button" value="Reset">
</div>
</body>
<script src="playable.js"></script>

</html>
22 changes: 22 additions & 0 deletions css-cookbook/playable.js
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);
Loading

0 comments on commit 5802985

Please sign in to comment.