×

HTML <svg> tag

SVG is used to determine the vector-based graphics in XML format.

What is SVG?

We utilize SVG tag to specify visuals for the website. The attribute of SVG in a HTML document serves as a container for all the SVG visuals.

There are several ways to draw text, boxes, pathways, and visual images with SVG.

Syntax:

<body>
<svg>
……………
</svg>
</body>

SVG Circle

Example:

<!DOCTYPE html>
<html>
<head>
< title >  html svg tag < /title >
</head>
<body>
<svg width=" 200 " height=" 200" >
<circle cx="100" cy="100" r="40" stroke="red" stroke-width="4" fill="blue" />
</svg>
</body>
</html>

Output:

Html <svg> tag

SVG Rectangle

Example

<!DOCTYPE html>
<html>
<head>
<title> html svg tag </title>
</head>
<body>
<svg width="400" height="200">
<rect width="400" height="200" style="fill:rgb(0,0,255);stroke-width:10;stroke:rgb(0,0,0)" />
</svg>
</body>
</html>

Output:

Html <svg> tag

SVG Rounded Rectangle

Example

<!DOCTYPE html>
<html>
<head>
<title> html svg tag </title>
</head>
<body>
<svg width="400" height="180">
<rect x="100" y="20" rx="20" ry="20" width="100" height="100"
  style="fill:red;stroke:black;stroke-width:5;opacity:0.5" />
</svg>
</body>
</html>

Output:

Html <svg> tag

SVG Star

Example

<!DOCTYPE html>
<html>
<head>
<title> html svg tag </title>
</head>
<body>
<svg width="400" height="400">
<polygon points="150,10 80,200 220,80 50,80 200,200"
  style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;" />
</svg>
</body>
</html>

Output:

Html <svg> tag

SVG Logo

Example

<!DOCTYPE html>
<html>
<head>
<title> html svg tag </title>
</head>
<body>
<svg height="130" width="1000">
<defs>
<linearGradient id="grad1" x1="0%" y1="0%" x2="200%" y2="0%">
<stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
<stop offset="200%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
</linearGradient>
</defs>
<ellipse cx="200" cy="70" rx="85" ry="55" fill="url(#grad1)" />
<text fill="#ffffff" font-size="45" font-family="Verdana" x="100" y="86">SVG</text>
  Sorry, your browser does not support inline SVG.
</svg>
</body>
</html>

Output:

Html <svg> tag

Browser support:

List of browsers that support html <section> tag are mentioned below:

Google Chrome: yes, Version 1 needed

Microsoft Edge: yes,  Version 12 needed

Firefox: Yes, Version 1.5 needed

Safari: Yes, Version 3 needed

Opera: Yes, Version 8 needed


Related Topics

HTML Reset Button

The HTML reset button is used to reset all values in the form. It clears all input fields. Reset is the value of the type attribute of the button element. The...

6 minutes read.

Html &lt;Col> Tag

You can write the col tag inside the table tag after the thead, tbody, foot, and tr tags. You can also apply it after the caption tag (in which the...

4 minutes read.

HTML Id Attribute

The HTML id attribute represents the unique identifier for an element of the HTML document. Each element has its unique identifier. The id attribute is a global attribute that can be...

12 minutes read.

What is a Container tag?

In HTML, there are different types of tags or say instructions which make the developer specify various elements in the document and make the browsers understand what to display. Tags in...

5 minutes read.

Design a tribute page using HTML and CSS

A tribute page is a webpage based on a person who inspired us in our life. In this article, we will create a webpage of Mahatma Gandhi. We are going...

5 minutes read.

Font tag in HTML

HTML stands for Hypertext Mark-up Language and is used to create web pages and other information that can be later displayed in a web browser. It also consists of a...

4 minutes read.

Html &lt;center> Tag

The term HTML refers to Hyper Text Markup Language. The most widely used markup language for making web pages is HTML. A structure of web page is described in HTML....

3 minutes read.

HTML <strike> tag

The HTML <strike> tag is used to specifies strikethrough text. The tag is deprecated now and <del> tag is used in HTML files instead of it. All the global and...

2 minutes read.

How to change font in HTML

To give style to the content of your website, you may change the font of the text and make your website look attractive to the user. There are several methods which...

4 minutes read.

HTML Audio

HTML AUDIO: HTML5 provides a method to embed the audio file into a webpage by using HTML5. Before HTML5 audio files is used to play on the browser with the help of...

1 minute read.

Responsive HTML5 and CSS3 Tutorial

Introduction to HTML5 Tutorial HTML5 is the latest and upgraded version of HTML. HTML is a hypertext markup language. Technically, it is not a programming language. It is a markup language. HTML...

17 minutes read.

HTML <table> tag

The Table element If we want to show the data and information in a two-dimensional table with rows and columns, then we can achieve this by using the HTML element <table>. Syntax: <body> <table> <thead> <tr> <thcolspan="#">………….</th> </tr> </thead> <tbody> <tr> <td>……….</td> <td>……….</td> </tr> </tbody> </table> </body> Example: <!DOCTYPE...

9 minutes read.

HTML <body> tag

HTML means Hyper Text Markup Language, which is most preferred for making Web pages. It explains how a Web page is put together. There are many different elements in HTML,...

3 minutes read.

HTML Tutorial

Introduction This HTML tutorial helps beginners and professionals to learn HTML easily. HTML is a widely used web technology for website development. It stands for Hyper Text Markup Language. It is mainly used to...

7 minutes read.

How to add Google Translate Button on your Webpage?

Google translator is a multi-language translator used for translating the webpage. Google develops it. In today's digital age, it is essential because information is available worldwide in some specific language...

5 minutes read.

HTML Elements

An HTML element is nothing but a starting tag and then some content and then the closing tag. So we can say HTML elements is everything from the starting tag...

3 minutes read.

HTML Search Box

The HTML search box is also known as the search bar. It is an input text field that is used to search the content. If the users want to explore...

7 minutes read.

HTML Frames

Frames in Html is used to divide the browser into different sections where each section can load different Html documents. Collection of frame is known as Frameset. Creating frames:We use frameset...

2 minutes read.

HTML Font Color

The HTML <font> tag has an attribute called color, which defines the color of the text. We use the color attribute inside the <font> tag to specify the color of...

6 minutes read.

How to insert image in HTML

An image (technically digital image) in HTML or even in general technical aspects is a binary representation of visual information. By visual information we mean, in the form of drawings/pictures,...

5 minutes read.