- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use .svg files in a webpage?
The svg files are Scalable Vector Graphics. You can add it to a web page using the <img>, <iframe>, <object> or <embed> tag.
The .svg file is to be referenced in the src attribute of the <img> tag. Let’s see how to add it using the <img> tag.
You can try to run the following code to learn how to use .svg files in a web page. We have a smiley.svg file −
<!DOCTYPE html> <html> <head> <title>HTML SVG</title> </head> <body> <h1>Design</h1> <img src= "https://www.tutorialspoint.com/html5/src/svg/extensions/imagelib/smiley.svg" id="demo" alt="smiley"> </body> </html>
- Related Articles
- Should I use , , or for SVG files?
- How to use an image in a webpage?
- How to use SVG images in HTML5?
- How to use xPath in Selenium WebDriver to grab SVG elements?
- How to draw a rectangle in HTML5 SVG?
- How to draw a polygon in HTML5 SVG?
- How to draw a polyline in HTML5 SVG?
- How to draw a star in HTML5 SVG?
- How to draw a hollow circle in SVG?
- How to use external “.js” files in an HTML file?
- How to use Glob() function to find files recursively in Python?
- How to use chrome webdriver in Selenium to download files in Python?