Skip to content

Instantly share code, notes, and snippets.

@cyancey76
Last active September 22, 2017 21:00
Show Gist options
  • Save cyancey76/1773833b7b77ebcfd5e278157dc48278 to your computer and use it in GitHub Desktop.
Save cyancey76/1773833b7b77ebcfd5e278157dc48278 to your computer and use it in GitHub Desktop.
Svg markup and symbol svg for multiple icons.
<svg role="img" aria-labelledby="uniqueTitleID uniqueDescID" id="" class="" viewBox="# # # #" >
<title id="uniqueTitleID">Title</title> <!-- for screen readers, must be first child -->
<desc id="uniqueDescID">Title</desc> <!-- for screen readers -->
<g>
</g>
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href=""></use>
</svg>
<!-- Standalone Icon, Meaningful -->
<svg role="img" height="" width="" fill="#fff">
<title>Title</title>
<use xlink:href="symbol.svg#symbol-1"></use>
</svg>
<!-- Standalone Icon, Decorative -->
<svg role="img" aria-hidden="true" height="" width="" fill="#fff">
<title>Title</title>
<use xlink:href="symbol.svg#symbol-1"></use>
</svg>
<!-- Linked Icon, no paired text -->
<a href="link" aria-label="Descriptive, alternative text">
<svg height="" width="" fill="#fff">
<title>Title</title>
<use xlink:href="symbol.svg#symbol-1"></use>
</svg>
</a>
<!-- Linked Icon, with static text -->
<a href="link" aria-label="Descriptive, alternative text">
<svg height="" width="" fill="#fff">
<title>Title</title>
<use xlink:href="symbol.svg#symbol-1"></use>
</svg>
Static Text
</a>
<!-- Linked Icon, with dynamic text -->
<a href="link">
<span id="descriptive-dynamic-value"></span>
<span class="descriptive-offscreen-text"></span>
<svg aria-hidden="true" height="" width="" fill="#fff">
<title>Title</title>
<use xlink:href="symbol.svg#symbol-1"></use>
</svg>
Static Text
</a>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment