-->

HTML graphics

We have two ways to work with graphics. They are:





HTML with SVG concept

Scalable Vector Graphics (SVG) is a 2D vector image format based on an XML syntax.

The W3C began work on SVG in the late 1990s, but SVG only became popular when Internet Explorer 9 came out with SVG support. All major browsers now support SVG.

Based on an XML syntax, SVG can be styled with CSS and made interactive using JavaScript. HTML5 now allows direct embedding of SVG tags in an HTML document.

As a vector image format, SVG graphics can scale infinitely, making them invaluable in responsive design, since you can create interface elements and graphics that scale to any screen size. SVG also provides a useful set of tools, such as clipping, masking, filters, and animations.(Source:https://developer.mozilla.org/en-US/docs/Glossary/SVG)

----------------------------------------------------------------------------------------------------------------

Let's understand SVG with the help of following examples.

-------------------------------------------------------------------------------------------

1)HTML with SVG to draw circle.

                                                                            click the solution

2)HTML with SVG to draw rectangle

                                                                           click the solution

3)HTML with SVG to draw rectangle

                                                                            click the solution

4)HTML with SVG to draw ellipse.

                                                                            click the solution

5)HTML with SVG to draw line

                                                                            click the solution

6)HTML with SVG to draw polygon.

                                                                            click the solution

7)HTML with SVG to draw polyline

                                                                            click the solution

8)HTML with SVG to draw path

                                                                            click the solution

9)HTML with SVG to draw text

                                                                            click the solution

10)HTML with SVG to draw text.

                                                                            click the solution

11)HTML with SVG to animate object.

                                                                             click the solution

12)HTML with SVG to animate the circle.

                                                                              click the solution


HTML graphics with CANVAS tag

The Canvas API provides a means for drawing graphics via JavaScript and the HTML <canvas> element. Among other things, it can be used for animation, game graphics, data visualization, photo manipulation, and real-time video processing.

The Canvas API largely focuses on 2D graphics. The WebGL API, which also uses the <canvas> element, draws hardware-accelerated 2D and 3D graphics.

     source:https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API

-----------------------------------------------------------------------------------------------------------------

LEt's understand about canvas in detail using following example.

--------------------------------------------------------------------------------------------------------

1)HTML with CANVAS to draw rectangle.

                                                                                                click me

2)HTML with CANVAS to draw square.

                                                                                                click here

3)HTML with canvas to draw straight line.

                                                                                                click here

4)HTML with canvas  to draw circle.

                                                                                               click here

5)HTML with canvas to draw arc.

                                                                                               click here

6)HTML with canvas to write text on canvas.

                                                                                              click here


7)   HTML with canvas to write text on canvas. with background color

                                                                                         click here

8)HTML with canvas to fill entire canvas with color

                                                                                              click here

                                                         

                       

HTML with pre tag

Let's have following example to understand about pre tag.
-------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>
pre tags
</title>
</head>
<body>
<pre>
WE
are
learning 
HTML.
</pre>
</body>
</html>

 

HTML page with hr tag

With the help of following example we can understand about hr tag.
----------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>
understanding horizontal line/ruler tag 
</title>
</head>
<body>
<hr width="100%" size="2px" color="#ABCDEF" align="right">

</body>
</html>

 

HTML font tag

How to work with font tag? We understand it using following HTML code.
--------------------------------------------------------------------------------------------------------
<html>
<head>
<title>
understanding font tag 
</title>
</head>
<body>
<font face="Impact" color="#123244" size="4">
first paragraph
</font>
<br>
<font face="Algerian" color="#222222" size="7">
We are learning html
</font>

</body>
</html>

 

HTml with marquee tag

Let's look at following example to understand better about marquee tag.
----------------------------------------------------------------------------------------------------
<html>q
<head>
<title>
understanding marquee tag 
</title>
</head>
<body>
<marquee direction="right" behavior="scroll"  bgcolor="green" >
<!--direction is right,in scroll an dbcakground color green
-->
my text
Impact
Tab Completion allows quickly completing words by pressing the tab key. When enabled, pressing Tab will expand the text to the left of the cursor into the best match, using Sublime Text's fuzzy matching algorithm.
</marquee>

<br>
<H4>second parAGRAPH<H4>
<marquee direction="left" behavior="slide" bgcolor="SKYBLUE">

Tab Completion is enabled by default.
</marquee>
</p>

</body>
</html>