-
Notifications
You must be signed in to change notification settings - Fork 843
/
Copy pathnested-h2-span.html
139 lines (119 loc) · 3.75 KB
/
nested-h2-span.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Multicol example - h2 spanning element inside article</title>
<style>
body {
font: 1.2em Helvetica, Arial, sans-serif;
margin: 20px;
padding: 0;
}
textarea {
font-family: monospace;
display: block;
margin-bottom: 10px;
height: 160px;
background-color: #F4F7F8;
border: none;
border-left: 6px solid #558ABB;
color: #4D4E53;
width: 90%;
max-width: 700px;
padding: 10px 10px 0px;
font-size: 90%;
}
textarea:nth-of-type(1) {
height: 80px
}
textarea:nth-of-type(2) {
height: 160px
}
.playable-buttons {
text-align: right;
width: 90%;
max-width: 700px;
padding: 5px 10px 5px 26px;
font-size: 100%;
}
section {
width: 90%;
max-width: 700px;
border: 1px solid #4D4E53;
border-radius: 2px;
padding: 10px 14px 10px 10px;
margin-bottom: 10px;
}
section input {
display: block;
margin: 5px;
}
h2 {
background-color: #4D4E53;
color: #fff;
}
</style>
<style class="editable">
.container {
column-width: 200px;
}
h2 {
column-span: all;
}
</style>
</head>
<body>
<section>
<div class="container">
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic. Gumbo beet greens corn soko endive gumbo gourd. </p>
<article>
<h2>A heading</h2>
<p>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.</p>
</article>
</div>
</section>
<textarea class="playable-css">
.container {
column-width: 200px;
}
h2 {
column-span: all;
}
</textarea>
<textarea id="code" class="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. Gumbo beet greens corn soko endive gumbo gourd.</p>
<article>
<h2>A heading</h2>
<p>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.</p>
</article>
</div>
</textarea>
<div class="playable-buttons">
<input id="reset" type="button" value="Reset">
</div>
</body>
<script>
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);
</script>
</html>