Skip to content

Commit 249ca0a

Browse files
committed
some images examples
1 parent b988ae7 commit 249ca0a

File tree

6 files changed

+359
-0
lines changed

6 files changed

+359
-0
lines changed

shapes/image/generated-content.html

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

shapes/image/simple-example.html

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

shapes/image/threshold.html

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

shapes/images/star-shape-large.png

15.5 KB
Loading

shapes/images/star-shape1-20.png

7.51 KB
Loading

shapes/images/star-shape1.png

7.04 KB
Loading

0 commit comments

Comments
 (0)