-
Notifications
You must be signed in to change notification settings - Fork 45
/
datauri.html
26 lines (26 loc) · 1.88 KB
/
datauri.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
<!doctype html>
<head>
<meta charset="utf-8">
<title>SVG as Foreground image</title>
<style>
p, h1 {text-align: center;}
img {display: block; width: 50%; margin: auto;}
</style>
<style>head,style:last-of-type {display: block; text-align: center; background-color: #dedede; border-radius: 15px; padding: 20px; font-family: comic sans; font-size: 20px;}
head * {display: none;}
</style>
<style contenteditable>
object {width: 50%;}
</style>
<body>
<h1>Clown Car Technique</h1>
<object data="data:image/svg+xml,<svg viewBox='0 0 300 329' preserveAspectRatio='xMidYMid meet' xmlns='http://www.w3.org/2000/svg'><title>Clown Car Technique</title><style>svg{background-size:100% 100%;background-repeat:no-repeat;}@media screen and (max-width: 400px){svg{background-image:url(images/small.png);}}@media screen and (min-width: 401px) and (max-width:700px){svg{ background-image:url(images/medium.png);}}@media screen and (min-width: 701px) and (max-width:1000px){svg{background-image:url(images/big.png);}}@media screen and (min-width:1001px){svg{background-image:url(images/huge.png);}}</style></svg>" type="image/svg+xml">
<!--[if lte IE 8]>
<img src="images/medium.png" alt="Fall back for IE">
<![endif]-->
</object>
<object data="data:image/svg+xml,<svg viewBox='0 0 300 329' preserveAspectRatio='xMidYMid meet' xmlns='http://www.w3.org/2000/svg'><title>Clown Car Technique</title><style>svg{background-size:100% 100%;background-repeat:no-repeat;@media screen and (max-width: 400px){svg{background-image:url(images/small.png);}}@media screen and (min-width: 401px) and (max-width:700px){svg{ background-image:url(images/medium.png);}}@media screen and (min-width: 701px) and (max-width:1000px){svg{background-image:url(images/big.png);}}</style></svg>" type="image/svg+xml"></object>
<p>Resize window or edit CSS to change clowns</p>
<p>SVG is a Data URI. Resize window or edit CSS to change clowns</p>
</body>
</html>