svg-sprite-toggle.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  6. <script src="https://rawgit.com/jonathantneal/svg4everybody/master/svg4everybody.js"></script>
  7. <title>SVG sprite preview | svg-sprite</title>
  8. <style>@charset "UTF-8";body{padding:0;margin:0;color:#666;background:#fafafa;font-family:Arial,Helvetica,sans-serif;font-size:1em;line-height:1.4}header{display:block;padding:3em 3em 2em 3em;background-color:#fff}header p{margin:2em 0 0 0}section{border-top:1px solid #eee;padding:2em 3em 0 3em}section ul{margin:0;padding:0}section li{display:inline;display:inline-block;background-color:#fff;position:relative;margin:0 2em 2em 0;vertical-align:top;border:1px solid #ccc;padding:1em 1em 3em 1em;cursor:default}.icon-box{margin:0;width:144px;height:144px;position:relative;background:#ccc url(data:image/gif;base64,R0lGODlhDAAMAIAAAMzMzP///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjEgNjQuMTQwOTQ5LCAyMDEwLzEyLzA3LTEwOjU3OjAxICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPi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gkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAAAwADAAAAhaEH6mHmmzcgzJAUG/NVGrfOZ8YLlABADs=) top left repeat;border:1px solid #ccc;display:table-cell;vertical-align:middle;text-align:center}.icon{display:inline;display:inline-block}h1{margin-top:0}h2{margin:0;padding:0;font-size:1em;font-weight:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:absolute;left:1em;right:1em;bottom:1em}footer{display:block;margin:0;padding:0 3em 3em 3em}footer p{margin:0;font-size:.7em}footer a{color:#0f7595;margin-left:0}</style>
  9. <!--
  10. Sprite image dimensions
  11. ====================================================================================================
  12. You will need to set the sprite image dimensions via CSS when you use them as inline SVG, otherwise
  13. they would become a huge 100% in size. You may use the following dimension classes for doing so.
  14. They might well be outsourced to an external stylesheet of course.
  15. -->
  16. <style type="text/css">
  17. .svg-ic_check_box_24px-dims { width: 24px; height: 24px; }
  18. .svg-ic_check_box_outline_blank_24px-dims { width: 24px; height: 24px; }
  19. .svg-ic_radio_button_off_24px-dims { width: 24px; height: 24px; }
  20. .svg-ic_radio_button_on_24px-dims { width: 24px; height: 24px; }
  21. .svg-ic_star_24px-dims { width: 24px; height: 24px; }
  22. .svg-ic_star_half_24px-dims { width: 24px; height: 24px; }
  23. .svg-ic_star_outline_24px-dims { width: 24px; height: 24px; }
  24. </style>
  25. <!--
  26. ====================================================================================================
  27. -->
  28. </head>
  29. <body>
  30. <!--
  31. Inline SVG sprite
  32. ====================================================================================================
  33. This is an inlined version of the generated SVG sprite. The single images may be <use>d everywhere
  34. below within this document. Please see https://github.com/jkphl/svg-sprite#inline-embedding for
  35. further details on how to create this embeddable sprite variant.
  36. -->
  37. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0" style="position:absolute">
  38. <defs>
  39. <svg width="24" height="24" viewBox="0 0 24 24" id="ic_check_box_24px" y="0"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg> <svg width="24" height="24" viewBox="0 0 24 24" id="ic_check_box_outline_blank_24px" y="24"><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/></svg> <svg width="24" height="24" viewBox="0 0 24 24" id="ic_radio_button_off_24px" y="48"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/></svg> <svg width="24" height="24" viewBox="0 0 24 24" id="ic_radio_button_on_24px" y="72"><path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/></svg> <svg width="24" height="24" viewBox="0 0 24 24" id="ic_star_24px" y="96"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/></svg> <svg width="24" height="24" viewBox="0 0 24 24" id="ic_star_half_24px" y="120"><path d="M22 9.74l-7.19-.62L12 2.5 9.19 9.13 2 9.74l5.46 4.73-1.64 7.03L12 17.77l6.18 3.73-1.63-7.03L22 9.74zM12 15.9V6.6l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.9z"/></svg> <svg width="24" height="24" viewBox="0 0 24 24" id="ic_star_outline_24px" y="144"><path d="M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"/></svg> </defs>
  40. </svg><!--
  41. ====================================================================================================
  42. -->
  43. <header>
  44. <h1>SVG sprite preview</h1>
  45. <p>This preview features two methods of using the generated sprite in conjunction with inline SVG. Please have a look at the HTML source for further details and be aware of the following constraints:</p>
  46. <ul>
  47. <li>Your browser has to <a href="http://caniuse.com/svg-html5" target="_blank">support inline SVG</a> for these techniques to work.</li>
  48. <li>The embedded sprite (A) slightly differs from the generated external one. Please <a href="https://github.com/jkphl/svg-sprite#inline-embedding" target="_blank">see the documentation</a> for details on how to create such an embeddable sprite.</li>
  49. <li>Internet Explorer up to version 11 doesn't support external sprites for use with inline SVG. For IE 9-11, you may polyfill this functionality with <a href="https://github.com/jonathantneal/svg4everybody" target="_blank">SVG for Everybody</a>.</li>
  50. </ul>
  51. </header>
  52. <section>
  53. <!--
  54. Inline SVG with embedded sprite
  55. ====================================================================================================
  56. These SVG images make use of fragment identifiers (IDs) and are extracted out of the inline sprite
  57. embedded above. They may be styled via CSS.
  58. -->
  59. <h3>A) Inline SVG with embedded sprite</h3>
  60. <ul>
  61. <li title="ic_check_box_24px">
  62. <div class="icon-box">
  63. <!-- ic_check_box_24px -->
  64. <svg viewBox="0 0 24 24" class="svg-ic_check_box_24px svg-ic_check_box_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  65. <use xlink:href="#ic_check_box_24px"></use>
  66. </svg>
  67. </div>
  68. <h2>ic_check_box_24px</h2>
  69. </li>
  70. <li title="ic_check_box_outline_blank_24px">
  71. <div class="icon-box">
  72. <!-- ic_check_box_outline_blank_24px -->
  73. <svg viewBox="0 24 24 24" class="svg-ic_check_box_outline_blank_24px svg-ic_check_box_outline_blank_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  74. <use xlink:href="#ic_check_box_outline_blank_24px"></use>
  75. </svg>
  76. </div>
  77. <h2>ic_check_box_outline_blank_24px</h2>
  78. </li>
  79. <li title="ic_radio_button_off_24px">
  80. <div class="icon-box">
  81. <!-- ic_radio_button_off_24px -->
  82. <svg viewBox="0 48 24 24" class="svg-ic_radio_button_off_24px svg-ic_radio_button_off_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  83. <use xlink:href="#ic_radio_button_off_24px"></use>
  84. </svg>
  85. </div>
  86. <h2>ic_radio_button_off_24px</h2>
  87. </li>
  88. <li title="ic_radio_button_on_24px">
  89. <div class="icon-box">
  90. <!-- ic_radio_button_on_24px -->
  91. <svg viewBox="0 72 24 24" class="svg-ic_radio_button_on_24px svg-ic_radio_button_on_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  92. <use xlink:href="#ic_radio_button_on_24px"></use>
  93. </svg>
  94. </div>
  95. <h2>ic_radio_button_on_24px</h2>
  96. </li>
  97. <li title="ic_star_24px">
  98. <div class="icon-box">
  99. <!-- ic_star_24px -->
  100. <svg viewBox="0 96 24 24" class="svg-ic_star_24px svg-ic_star_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  101. <use xlink:href="#ic_star_24px"></use>
  102. </svg>
  103. </div>
  104. <h2>ic_star_24px</h2>
  105. </li>
  106. <li title="ic_star_half_24px">
  107. <div class="icon-box">
  108. <!-- ic_star_half_24px -->
  109. <svg viewBox="0 120 24 24" class="svg-ic_star_half_24px svg-ic_star_half_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  110. <use xlink:href="#ic_star_half_24px"></use>
  111. </svg>
  112. </div>
  113. <h2>ic_star_half_24px</h2>
  114. </li>
  115. <li title="ic_star_outline_24px">
  116. <div class="icon-box">
  117. <!-- ic_star_outline_24px -->
  118. <svg viewBox="0 144 24 24" class="svg-ic_star_outline_24px svg-ic_star_outline_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  119. <use xlink:href="#ic_star_outline_24px"></use>
  120. </svg>
  121. </div>
  122. <h2>ic_star_outline_24px</h2>
  123. </li>
  124. </ul>
  125. <!--
  126. ====================================================================================================
  127. -->
  128. <!--
  129. Inline SVG with external sprite
  130. ====================================================================================================
  131. These SVG images make use of an URL + fragment identifiers (IDs) and refer to the regular external
  132. SVG sprite. They may be styled via CSS. (IE 9-11 with polyfill only)
  133. -->
  134. <h3>B) Inline SVG with external sprite (IE 9-11 with polyfill only)</h3>
  135. <ul>
  136. <li title="ic_check_box_24px">
  137. <div class="icon-box">
  138. <!-- ic_check_box_24px -->
  139. <svg viewBox="0 0 24 24" class="svg-ic_check_box_24px svg-ic_check_box_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  140. <use xlink:href="svg/sprite.svg#ic_check_box_24px"></use>
  141. </svg>
  142. </div>
  143. <h2>ic_check_box_24px</h2>
  144. </li>
  145. <li title="ic_check_box_outline_blank_24px">
  146. <div class="icon-box">
  147. <!-- ic_check_box_outline_blank_24px -->
  148. <svg viewBox="0 24 24 24" class="svg-ic_check_box_outline_blank_24px svg-ic_check_box_outline_blank_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  149. <use xlink:href="svg/sprite.svg#ic_check_box_outline_blank_24px"></use>
  150. </svg>
  151. </div>
  152. <h2>ic_check_box_outline_blank_24px</h2>
  153. </li>
  154. <li title="ic_radio_button_off_24px">
  155. <div class="icon-box">
  156. <!-- ic_radio_button_off_24px -->
  157. <svg viewBox="0 48 24 24" class="svg-ic_radio_button_off_24px svg-ic_radio_button_off_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  158. <use xlink:href="svg/sprite.svg#ic_radio_button_off_24px"></use>
  159. </svg>
  160. </div>
  161. <h2>ic_radio_button_off_24px</h2>
  162. </li>
  163. <li title="ic_radio_button_on_24px">
  164. <div class="icon-box">
  165. <!-- ic_radio_button_on_24px -->
  166. <svg viewBox="0 72 24 24" class="svg-ic_radio_button_on_24px svg-ic_radio_button_on_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  167. <use xlink:href="svg/sprite.svg#ic_radio_button_on_24px"></use>
  168. </svg>
  169. </div>
  170. <h2>ic_radio_button_on_24px</h2>
  171. </li>
  172. <li title="ic_star_24px">
  173. <div class="icon-box">
  174. <!-- ic_star_24px -->
  175. <svg viewBox="0 96 24 24" class="svg-ic_star_24px svg-ic_star_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  176. <use xlink:href="svg/sprite.svg#ic_star_24px"></use>
  177. </svg>
  178. </div>
  179. <h2>ic_star_24px</h2>
  180. </li>
  181. <li title="ic_star_half_24px">
  182. <div class="icon-box">
  183. <!-- ic_star_half_24px -->
  184. <svg viewBox="0 120 24 24" class="svg-ic_star_half_24px svg-ic_star_half_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  185. <use xlink:href="svg/sprite.svg#ic_star_half_24px"></use>
  186. </svg>
  187. </div>
  188. <h2>ic_star_half_24px</h2>
  189. </li>
  190. <li title="ic_star_outline_24px">
  191. <div class="icon-box">
  192. <!-- ic_star_outline_24px -->
  193. <svg viewBox="0 144 24 24" class="svg-ic_star_outline_24px svg-ic_star_outline_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  194. <use xlink:href="svg/sprite.svg#ic_star_outline_24px"></use>
  195. </svg>
  196. </div>
  197. <h2>ic_star_outline_24px</h2>
  198. </li>
  199. </ul>
  200. <!--
  201. ====================================================================================================
  202. -->
  203. </section>
  204. <footer>
  205. <p>Generated at Wed, 12 Nov 2014 20:00:35 GMT by <a href="https://github.com/jkphl/svg-sprite" target="_blank">svg-sprite</a>.</p>
  206. </footer>
  207. </body>
  208. </html>