I want to use a sprite for svg icons. The test svg sprite-sheet looks like this:
sprites.svg
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="orange" viewBox="0 0 140 140">
<path fill="orange" d="M70 0A70 70 0 1071 0Z"/>
</symbol>
<symbol id="blue" viewBox="0 0 140 140">
<path fill="steelblue" d="M70 0A70 70 0 1071 0Z"/>
</symbol>
</defs>
</svg>
The corresponding html file where I try to display the symbol #blue looks like that:
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>SVG Test</title>
</head>
<body>
<svg><use href="sprites.svg#blue" /></svg>
</body>
</html>
Unfortunately, the browser does not display the icon. In Firefox, the developer console gets me the following information:
<body>
<svg>
<use href="sprites.svg#blue">
#shadow-root (closed)
</use>
</svg>
</body>
Google Chrome doesn't say anything at all.
So all I have are two simple files, one html index file and one svg sprites file. But although I've read a lot about svgs and sprites and how to use them, I'm still not able to display a simple icon on a simple web page.
Can anybody please tell me what big thing I am missing? Am I that stupid or is SVG just another great idea but practically useless unless you'll have a degree in rocket science?
Many thanks for any information