Skip to content

Commit b988ae7

Browse files
committed
additional ellipse example
1 parent 4eed8bd commit b988ae7

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>CSS Shapes Basic Shapes: ellipse() keywords</title>
7+
8+
<style>
9+
body {
10+
font: 1.2em Helvetica, Arial, sans-serif;
11+
margin: 20px;
12+
padding: 0;
13+
}
14+
15+
textarea {
16+
font-family: monospace;
17+
display: block;
18+
margin-bottom: 10px;
19+
background-color: #F4F7F8;
20+
border: none;
21+
border-left: 6px solid #558ABB;
22+
color: #4D4E53;
23+
width: 90%;
24+
max-width: 700px;
25+
padding: 10px 10px 0px;
26+
font-size: 90%;
27+
}
28+
29+
textarea:nth-of-type(1) {
30+
height: 80px
31+
}
32+
33+
textarea:nth-of-type(2) {
34+
height: 160px
35+
}
36+
37+
.playable-buttons {
38+
text-align: right;
39+
width: 90%;
40+
max-width: 700px;
41+
padding: 5px 10px 5px 26px;
42+
font-size: 100%;
43+
}
44+
45+
section {
46+
width: 90%;
47+
max-width: 700px;
48+
border: 1px solid #4D4E53;
49+
border-radius: 2px;
50+
padding: 10px 14px 10px 10px;
51+
margin-bottom: 10px;
52+
}
53+
54+
section input {
55+
display: block;
56+
margin: 5px;
57+
}
58+
59+
</style>
60+
<style class="editable">
61+
.shape {
62+
float: left;
63+
shape-outside: ellipse(closest-side farthest-side at 30%);
64+
width: 100px;
65+
height: 140px;
66+
}
67+
</style>
68+
</head>
69+
70+
<body>
71+
<section>
72+
<div class="box">
73+
<div class="shape"></div>
74+
<p>One November night in the year 1782, so the story runs, two brothers sat over their winter fire in the little French town of Annonay, watching the grey smoke-wreaths from the hearth curl up the wide chimney. Their names were Stephen and Joseph Montgolfier, they were papermakers by trade, and were noted as possessing thoughtful minds and a deep interest in all scientific knowledge and new discovery. Before that night—a memorable night, as it was to prove—hundreds of millions of people had watched the rising smoke-wreaths of their fires without drawing any special inspiration from the fact.”</p>
75+
</div>
76+
77+
</section>
78+
<textarea class="playable-css">.shape {
79+
float: left;
80+
shape-outside: ellipse(closest-side farthest-side at 30%);
81+
margin: 20px;
82+
width: 100px;
83+
height: 140px;
84+
}</textarea>
85+
<textarea id="code" class="playable-html">
86+
<div class="box">
87+
<div class="shape"></div>
88+
<p>One November night in the year 1782, so the story runs, two brothers sat over their winter fire in the little French town of Annonay, watching the grey smoke-wreaths from the hearth curl up the wide chimney. Their names were Stephen and Joseph Montgolfier, they were papermakers by trade, and were noted as possessing thoughtful minds and a deep interest in all scientific knowledge and new discovery. Before that night—a memorable night, as it was to prove—hundreds of millions of people had watched the rising smoke-wreaths of their fires without drawing any special inspiration from the fact.</p>
89+
</div>
90+
</textarea>
91+
<div class="playable-buttons">
92+
<input id="reset" type="button" value="Reset">
93+
</div>
94+
</body>
95+
<script>
96+
var section = document.querySelector('section');
97+
var editable = document.querySelector('.editable');
98+
var textareaHTML = document.querySelector('.playable-html');
99+
var textareaCSS = document.querySelector('.playable-css');
100+
var reset = document.getElementById('reset');
101+
var htmlCode = textareaHTML.value;
102+
var cssCode = textareaCSS.value;
103+
104+
function fillCode() {
105+
editable.innerHTML = textareaCSS.value;
106+
section.innerHTML = textareaHTML.value;
107+
}
108+
109+
reset.addEventListener('click', function () {
110+
textareaHTML.value = htmlCode;
111+
textareaCSS.value = cssCode;
112+
fillCode();
113+
});
114+
115+
textareaHTML.addEventListener('input', fillCode);
116+
textareaCSS.addEventListener('input', fillCode);
117+
window.addEventListener('load', fillCode);
118+
</script>
119+
120+
</html>

0 commit comments

Comments
 (0)