SVG Star Ratings with Partially Filled Star

Size
2,397 Kb
Views
18,216

How do I make an svg star ratings with partially filled star?

What is a svg star ratings with partially filled star? How do you make a svg star ratings with partially filled star? This script and codes were developed by Martin Michálek on 22 November 2022, Tuesday.

SVG Star Ratings with Partially Filled Star Previews

SVG Star Ratings with Partially Filled Star - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>SVG Star Ratings with Partially Filled Star</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel='stylesheet prefetch' href='css/azrero.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <svg class="star-source" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <g id="icon-star"> <path d="M20.388,10.918L32,12.118l-8.735,7.749L25.914,31.4l-9.893-6.088L6.127,31.4l2.695-11.533L0,12.118 l11.547-1.2L16.026,0.6L20.388,10.918z" /> </g> <linearGradient id="halfGradient"> <stop stop-opacity="1" offset="50%" stop-color="#48440E"></stop> <stop stop-opacity="0" offset="50%"></stop> </linearGradient> </defs>
</svg>
<p> <svg class="star" viewBox="0 0 180 32"> <desc> <p>Uživateli hodnoceno třemi a půl hvězdičkami z pěti.</p> </desc> <use xlink:href="#icon-star" x="0" y="0" /> <use xlink:href="#icon-star" x="36" y="0" /> <use xlink:href="#icon-star" x="72" y="0" /> <use xlink:href="#icon-star" x="108" y="0" class="star--half" /> <use xlink:href="#icon-star" x="144" y="0" class="star--empty" /> </svg>
</p>
</body>
</html>

SVG Star Ratings with Partially Filled Star - Script Codes CSS Codes

.star { fill: #48440E;	stroke: #48440E;	stroke-width: 1;
}
/* Half-filled star using gradient -------------------------------- (CSS gradient does not work here)
*/
.star--half { fill:url(#halfGradient);
}
.star--empty { fill: none;
}
/* Not so important styles: */
.star { height: 5em;
}
.star-source { position: absolute; width: 0; top: 0;
}
/* IE11 */
svg { display: inline-block; vertical-align: top; }
SVG Star Ratings with Partially Filled Star - Script Codes
SVG Star Ratings with Partially Filled Star - Script Codes
Home Page Home
Developer Martin Michálek
Username machal
Uploaded November 22, 2022
Rating 3
Size 2,397 Kb
Views 18,216
Do you need developer help for SVG Star Ratings with Partially Filled Star?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Martin Michálek (machal) Script Codes
Create amazing captions with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!