0% found this document useful (0 votes)
17 views3 pages

HTML and SVG Canvas Examples

The document contains examples of HTML markup using different canvas, SVG, and styling elements. It includes multiple code snippets demonstrating drawing shapes, text, images, and gradients on canvas elements.

Uploaded by

Anytime Fitness
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

HTML and SVG Canvas Examples

The document contains examples of HTML markup using different canvas, SVG, and styling elements. It includes multiple code snippets demonstrating drawing shapes, text, images, and gradients on canvas elements.

Uploaded by

Anytime Fitness
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

6.

<html> <h1 style="border:2px </body>


<head> solid </html>
<title>sadfd</title>
</head> Tomato;">Hello
<body> World</h1>
<h1 style="background- <h1 style="border:2px
solid
color:DodgerBlue;">Hello
DodgerBlue;">Hello
World</h1> World</h1>
<p style="background- <h1 style="border:2px
solid
color:Tomato;">Lorem
ipsum...</p> Violet;">Hello
</body> World</h1>
</html>
7. <html> </body>
<head> </html>
<title>sadfd</title> 9. <html>
</head> <head>
<body> <title>sadfd</title>
<h1 </head>
style="color:Tomato;">He <body>
llo <h1 style="background-
color:rgb
World</h1>
<p (255, 99, 71);">...</h1>
<h1 style="background-
style="color:DodgerBlue;"
>Lorem color:#ff6347;">...</h1>
<h1 style="background-
ipsum...</p> color:hsl(9,
<p
100%, 64%);">...</h1>
style="color:MediumSeaG
reen;">Ut <h1 style="background-
color:rgba
wisi enim...</p>
(255, 99, 71,
</body> 0.5);">...</h1>
</html> <h1 style="background-
8. <html> color:hsla
<head>
<title>sadfd</title> (9, 100%, 64%,
</head> 0.5);">...</h1>
1.
<body> <canvas id="myCanvas" w
idth="200" height="100" [Link]("2d"); <svg width="100" height
style="border:1px solid ="100">
#000000;"> // Create gradient <circle cx="50" cy="5
</canvas> var grd = 0" r="40" stroke="green
[Link] " stroke-width="4" fil
2. <script> t(0, 0, 200, 0); l="yellow" />
var c = [Link](0, "re </svg>
[Link] d");
("myCanvas"); [Link](1, "wh </body>
var ctx = ite"); </html>
[Link]("2d");
[Link](0, 0); // Fill with gradient 9.
[Link](200, 100); [Link] = grd; <svg width="400" height
[Link](); [Link](10, 10, 15 ="100">
</script> 0, 80); <rect width="400" hei
</script> ght="100" style="fill:r
3. <script> gb(0,0,255);stroke-
var c = width:10;stroke:rgb(0,0
[Link] 7. <script> ,0)" />
("myCanvas"); var c = </svg>
var ctx = [Link]
[Link]("2d"); ("myCanvas"); 10.
[Link](); var ctx = <svg width="400" height
[Link](95, 50, 40, 0, [Link]("2d"); ="180">
2 * [Link]); <rect x="50" y="20" r
[Link](); // Create gradient x="20" ry="20" width="1
</script> var grd = 50" height="150"
[Link]
4. <script> t(75, 50, 5, 90, 60, 10 style="fill:red;stroke:
var c = 0); black;stroke-
[Link] [Link](0, "re width:5;opacity:0.5" />
("myCanvas"); d"); </svg>
var ctx = [Link](1, "wh
[Link]("2d"); ite"); 11.
[Link] = "30px <svg width="300" height
Arial"; // Fill with gradient ="200">
[Link]("Hello [Link] = grd; <polygon points="100,
World", 10, 50); [Link](10, 10, 15 10 40,198 190,78 10,78
</script> 0, 80); 160,198"
</script>
5. <script> style="fill:lime;stroke
var c = 8. <script> :purple;stroke-
[Link] var c = width:5;fill-
("myCanvas"); [Link] rule:evenodd;" />
var ctx = ("myCanvas"); </svg>
[Link]("2d"); var ctx =
[Link] = "30px [Link]("2d"); 12.
Arial"; var img = <svg height="130" width
[Link]("Hello [Link] ="500">
World", 10, 50); ("scream"); <defs>
</script> [Link](img, 10, <linearGradient id=
10); "grad1" x1="0%" y1="0%"
6. <script> </script> x2="100%" y2="0%">
var c = <stop offset="0%"
[Link] 8. <html> style="stop-
("myCanvas"); <body> color:rgb(255,255,0);st
var ctx = op-opacity:1" />
<stop offset="100
%" style="stop-
color:rgb(255,0,0);stop
-opacity:1" />
</linearGradient>
</defs>
<ellipse cx="100" cy=
"70" rx="85" ry="55" fi
ll="url(#grad1)" />
<text fill="#ffffff"
font-size="45" font-
family="Verdana" x="50"
y="86">SVG</text>
Sorry, your browser
does not support inline
SVG.
</svg>

13.

You might also like