The shape-rendering attribute hints the renderer about the tradeoff’s to be made while rendering shapes like paths, circles, or rectangles. It has effect only on the following elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect>.
Syntax:
shape-rendering = auto | optimizeSpeed | crispEdges
| geometricPrecision
Attribute Values: The shape-rendering attribute accepts the values mentioned above and described below:
- auto: This value lets the user agent to make automatic decision to balance the speed, have crisp edges or have good geometric precision. When nothing is specified then this value acts as the default value.
- optimizeSpeed:This value lets the user agent to specify that the shape will be rendered in a manner to emphasize speed over geometric precision or crisp edges.
- crispEdges:This value lets the user agent to specify that the shape will be rendered with an emphasis given to the contrast of clean edges over geometric precision or speed.
- geometricPrecision: This value lets the user agent to specify that the shape will be rendered with geometric precision rather than focusing on the speed or crisp edges.
Example 1: Below examples illustrate the use of shape-rendering attribute using geometricPrecision attribute value.
HTML
<!DOCTYPE html>
<html>
<body>
<div style="color: green;
margin-left: 50px;">
<h1>
GeeksforGeeks
</h1>
<svg viewBox="0 0 420 100"
<polygon points="26, 86 11.2, 40.4 50,
12.2 88.8, 40.4 74, 86" fill="green"
shape-rendering="geometricPrecision" />
</svg>
</div>
</body>
</html>
|
Output:

Example 2: Below examples illustrate the use of shape-rendering attribute using crispEdges attribute value.
HTML
<!DOCTYPE html>
<html>
<body>
<div style="color: green;
margin-left: 50px;">
<h1>GeeksforGeeks</h1>
<svg viewBox="0 0 420 100"
<polygon points="26, 86 11.2, 40.4
50, 12.2 88.8, 40.4 74, 86"
fill="green"
shape-rendering="crispEdges" />
</svg>
</div>
</body>
</html>
|
Output:

Learn to code easily with our course
Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated :
31 Mar, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...