Skip to content

Commit 36bade9

Browse files
committed
More examples
1 parent 249ca0a commit 36bade9

File tree

5 files changed

+395
-2
lines changed

5 files changed

+395
-2
lines changed

shapes/image/generated-content.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
content: "";
6363
float: left;
6464
width: 400px;
65-
height: 420px;
65+
height: 300px;
6666
shape-outside: url(../images/star-shape-large.png);
6767
shape-image-threshold: .3;
6868
}
@@ -81,7 +81,7 @@
8181
content: "";
8282
float: left;
8383
width: 400px;
84-
height: 420px;
84+
height: 300px;
8585
shape-outside: url(../images/star-shape-large.png);
8686
shape-image-threshold: .3;
8787
}

shapes/image/gradient.html

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>CSS Shapes from Images: simple example</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+
.box::before {
62+
content: "";
63+
float: left;
64+
height: 250px;
65+
width: 400px;
66+
background-image: linear-gradient(to bottom right, rebeccapurple, transparent);
67+
shape-outside: linear-gradient(to bottom right, rebeccapurple, transparent);
68+
shape-image-threshold: .3;
69+
}
70+
</style>
71+
</head>
72+
73+
<body>
74+
<section>
75+
<div class="box">
76+
<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>
77+
</div>
78+
79+
</section>
80+
<textarea class="playable-css">
81+
.box::before {
82+
content: "";
83+
float: left;
84+
height: 250px;
85+
width: 400px;
86+
background-image: linear-gradient(to bottom right, rebeccapurple, transparent);
87+
shape-outside: linear-gradient(to bottom right, rebeccapurple, transparent);
88+
shape-image-threshold: .3;
89+
}
90+
</textarea>
91+
<textarea id="code" class="playable-html">
92+
<div class="box">
93+
<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>
94+
</div>
95+
</textarea>
96+
<div class="playable-buttons">
97+
<input id="reset" type="button" value="Reset">
98+
</div>
99+
</body>
100+
<script>
101+
var section = document.querySelector('section');
102+
var editable = document.querySelector('.editable');
103+
var textareaHTML = document.querySelector('.playable-html');
104+
var textareaCSS = document.querySelector('.playable-css');
105+
var reset = document.getElementById('reset');
106+
var htmlCode = textareaHTML.value;
107+
var cssCode = textareaCSS.value;
108+
109+
function fillCode() {
110+
editable.innerHTML = textareaCSS.value;
111+
section.innerHTML = textareaHTML.value;
112+
}
113+
114+
reset.addEventListener('click', function () {
115+
textareaHTML.value = htmlCode;
116+
textareaCSS.value = cssCode;
117+
fillCode();
118+
});
119+
120+
textareaHTML.addEventListener('input', fillCode);
121+
textareaCSS.addEventListener('input', fillCode);
122+
window.addEventListener('load', fillCode);
123+
</script>
124+
125+
</html>

shapes/image/margin.html

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>CSS Shapes from Images: Using shape-margin</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+
img {
62+
float: left;
63+
shape-outside: url(../images/star-shape1-20.png);
64+
shape-image-threshold: .2;
65+
shape-margin: 20px;
66+
}
67+
</style>
68+
</head>
69+
70+
<body>
71+
<section>
72+
<div class="box">
73+
<img src="../images/star-shape1-20.png" alt="star">
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">
79+
img {
80+
float: left;
81+
shape-outside: url(../images/star-shape1-20.png);
82+
shape-image-threshold: .2;
83+
shape-margin: 20px;
84+
}
85+
</textarea>
86+
<textarea id="code" class="playable-html">
87+
<div class="box">
88+
<img src="../images/star-shape1-20.png" alt="star">
89+
<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>
90+
</div>
91+
</textarea>
92+
<div class="playable-buttons">
93+
<input id="reset" type="button" value="Reset">
94+
</div>
95+
</body>
96+
<script>
97+
var section = document.querySelector('section');
98+
var editable = document.querySelector('.editable');
99+
var textareaHTML = document.querySelector('.playable-html');
100+
var textareaCSS = document.querySelector('.playable-css');
101+
var reset = document.getElementById('reset');
102+
var htmlCode = textareaHTML.value;
103+
var cssCode = textareaCSS.value;
104+
105+
function fillCode() {
106+
editable.innerHTML = textareaCSS.value;
107+
section.innerHTML = textareaHTML.value;
108+
}
109+
110+
reset.addEventListener('click', function () {
111+
textareaHTML.value = htmlCode;
112+
textareaCSS.value = cssCode;
113+
fillCode();
114+
});
115+
116+
textareaHTML.addEventListener('input', fillCode);
117+
textareaCSS.addEventListener('input', fillCode);
118+
window.addEventListener('load', fillCode);
119+
</script>
120+
121+
</html>

shapes/image/radial-gradient.html

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>CSS Shapes from Images: simple example</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+
.box::before {
62+
content: "";
63+
float: left;
64+
height: 250px;
65+
width: 400px;
66+
background-image: radial-gradient(ellipse closest-side, rebeccapurple, blue 50%, transparent);
67+
shape-outside: radial-gradient(ellipse closest-side, rebeccapurple, blue 50%, transparent);
68+
shape-image-threshold: .3;
69+
}
70+
</style>
71+
</head>
72+
73+
<body>
74+
<section>
75+
<div class="box">
76+
<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>
77+
</div>
78+
79+
</section>
80+
<textarea class="playable-css">
81+
.box::before {
82+
content: "";
83+
float: left;
84+
height: 250px;
85+
width: 400px;
86+
background-image: radial-gradient(ellipse closest-side, rebeccapurple, blue 50%, transparent);
87+
shape-outside: radial-gradient(ellipse closest-side, rebeccapurple, blue 50%, transparent);
88+
shape-image-threshold: .3;
89+
}
90+
</textarea>
91+
<textarea id="code" class="playable-html">
92+
<div class="box">
93+
<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>
94+
</div>
95+
</textarea>
96+
<div class="playable-buttons">
97+
<input id="reset" type="button" value="Reset">
98+
</div>
99+
</body>
100+
<script>
101+
var section = document.querySelector('section');
102+
var editable = document.querySelector('.editable');
103+
var textareaHTML = document.querySelector('.playable-html');
104+
var textareaCSS = document.querySelector('.playable-css');
105+
var reset = document.getElementById('reset');
106+
var htmlCode = textareaHTML.value;
107+
var cssCode = textareaCSS.value;
108+
109+
function fillCode() {
110+
editable.innerHTML = textareaCSS.value;
111+
section.innerHTML = textareaHTML.value;
112+
}
113+
114+
reset.addEventListener('click', function () {
115+
textareaHTML.value = htmlCode;
116+
textareaCSS.value = cssCode;
117+
fillCode();
118+
});
119+
120+
textareaHTML.addEventListener('input', fillCode);
121+
textareaCSS.addEventListener('input', fillCode);
122+
window.addEventListener('load', fillCode);
123+
</script>
124+
125+
</html>

0 commit comments

Comments
 (0)