SVG Articles

Found 9 articles

HTML5 SVG css3 transition on fill not working when there is external link

Nancy Den
Nancy Den
Updated on 15-Mar-2026 176 Views

CSS3 transitions on SVG fill properties don't work when links are in a visited state due to browser security restrictions. Browsers limit styling capabilities for visited links to prevent privacy attacks. The Problem When an SVG element is inside a visited link, CSS transitions on the fill property are disabled by the browser. This is a security feature to prevent websites from detecting your browsing history. Solution: Adding Random Query Parameters The most effective solution is to add a random query parameter to your URLs, making each link appear "unvisited" to the browser.

Read More

How to either determine SVG text box width or force line breaks after 'x' characters?

Krantik Chavan
Krantik Chavan
Updated on 15-Mar-2026 312 Views

When working with SVG text elements, you often need to control text wrapping since SVG doesn't automatically wrap text like HTML. This tutorial shows how to measure text width using getBBox() and implement word wrapping. The Problem SVG text elements don't wrap automatically. Long text will extend beyond boundaries, requiring manual line breaks based on width measurements. Using getBBox() for Text Measurement The getBBox() method returns the bounding box dimensions of SVG elements, including text width and height. ...

Read More

How to draw sine waves with HTML5 SVG?

Anvi Jain
Anvi Jain
Updated on 15-Mar-2026 1K+ Views

To draw sine waves with HTML5 SVG, you can use the element with cubic Bezier curves to closely approximate the smooth curves of a sine wave. This approach provides precise control over wave shape and amplitude. Basic Sine Wave Example Here's how to create a simple sine wave using SVG path with cubic Bezier approximation: SVG Sine Waves HTML5 SVG Sine Wave ...

Read More

Align HTML5 SVG to the center of the screen

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 3K+ Views

SVG stands for Scalable Vector Graphics and it is a language for describing 2D-graphics and graphical applications in XML. HTML5 provides native SVG support, and centering SVG elements on a webpage requires specific CSS techniques. Method 1: Using Auto Margins and Display Block The simplest way to center an SVG horizontally is using auto margins with display block: #svgelem { margin-left: auto; ...

Read More

How to draw on scroll using JavaScript and SVG?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 589 Views

Drawing on scroll using JavaScript and SVG creates an engaging animation effect where an SVG path gradually appears as the user scrolls down the page. This technique uses stroke-dasharray and stroke-dashoffset properties to control path visibility. How It Works The technique uses SVG's stroke-dasharray and stroke-dashoffset properties to hide the path initially, then gradually reveals it based on scroll position. The path length is calculated and used to synchronize the drawing with scroll progress. SVG Path Drawing Animation Initial State (Hidden) ...

Read More

Difference between JPEG and SVG

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 11-Jan-2023 5K+ Views

JPEG and SVG are types of image formats. JPEG is a raster image format that uses a lossy compression algorithm to compress an image, whereas SVG is a highly scalable, text-based image format that uses mathematical structures to represent an image. JPEG images are used in photography applications, while SVG is used when high-resolution images are required. JPEG is a good choice for photographs and other images with lots of colors, while SVG is a better choice for simple images and graphics that need to be resized, such as logos and icons. Read this article to find out more about ...

Read More

How can I get the output of a Matplotlib plot as an SVG?

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 17-Mar-2021 17K+ Views

Just using the savefig method of the pyplot package and mentioning the file format, we can save the output as a SVG format.StepsCreate fig and ax variables using subplots method, where default nrows and ncols are 1.Create xpoints and ypoints using np.array(0, 5).Plot lines using xpoints and ypoints.Set the X-axis label using plt.xlabel() method.Set the Y-axis label using plt.ylabel() method.To save the file in SVG format, use savefig() method where image name is myImagePDF.svg, format="svg".To show the image, use plt.show() method.Exampleimport matplotlib.pyplot as plt import numpy as np fig, ax = plt.subplots() xpoints = np.array([0, 5]) ypoints = np.array([0, ...

Read More

Should I use , , or for SVG files?

Swarali Sree
Swarali Sree
Updated on 26-Jun-2020 516 Views

To add SVG files, you can use , or element in HTML. Choose any one of them according to your requirement. Here’s how you can add SVG, elementUse the tag for images without interaction.The disadvantage is you cannot manipulate images with JavaScript. elementThe element is used to define an embedded object within an HTML document. Use it to embed multimedia like audio, video, flash, etc in the web page.    Your browser does not support SVG elementThe tag wasn’t part of the HTML 4 specification and is new in HTML5. It validates in an HTML5 page.

Read More

How to use .svg files in a webpage?

Swarali Sree
Swarali Sree
Updated on 26-Jun-2020 768 Views

The svg files are Scalable Vector Graphics. You can add it to a web page using the , , or tag.The .svg file is to be referenced in the src attribute of the tag. Let’s see how to add it using the 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 −           HTML SVG               Design          

Read More
Showing 1–9 of 9 articles
« Prev 1 Next »
Advertisements