I need to place a close button in the top right corner of my page.
Here is the code for the SVG:
.icon {
width: 24px;
height: 24px;
/* any changes to the fill attribute have no effect */
fill: currentColor;
}
<svg class="icon">
<use xlink:href="#close" />
</svg>
<!-- additional code -->
<!-- SVG Icon Library -->
<svg style="display: none;">
<symbol id=close viewBox="0 0 24 24">
<path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
</symbol>
</svg>
The close icon is not appearing on the page.
However, I have another example with a different icon that does work...
.icon {
width: 24px;
height: 24px;
/* any changes to the fill attribute have no effect */
fill: currentColor;
}
<svg class="icon">
<use xlink:href="#info-outline" />
</svg>
<!-- additional code -->
<!-- SVG Icon Library -->
<svg style="display: none;">
<symbol id=info-outline viewBox="0 0 24 24">
<path d="M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 9h2V7h-2v2z"></path>
</symbol>
</svg>
Both examples are similar, and it's puzzling why the close icon is not showing up.
I have tried adjusting the size and fill attribute of the SVG, but it seems to have no impact. The Dev-Tools confirm that the icon has a normal size. Other SVG icons work as expected, so there must be something specific to the close icon causing the issue.