svg-sprite-alert.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjEgNjQuMTQwOTQ5LCAyMDEwLzEyLzA3LTEwOjU3OjAxICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwO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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_error_24px-dims { width: 24px; height: 24px; }
  18. .svg-ic_warning_24px-dims { width: 24px; height: 24px; }
  19. </style>
  20. <!--
  21. ====================================================================================================
  22. -->
  23. </head>
  24. <body>
  25. <!--
  26. Inline SVG sprite
  27. ====================================================================================================
  28. This is an inlined version of the generated SVG sprite. The single images may be <use>d everywhere
  29. below within this document. Please see https://github.com/jkphl/svg-sprite#inline-embedding for
  30. further details on how to create this embeddable sprite variant.
  31. -->
  32. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0" height="0" style="position:absolute">
  33. <defs>
  34. <svg width="24" height="24" viewBox="0 0 24 24" id="ic_error_24px" y="0"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg> <svg width="24" height="24" viewBox="0 0 24 24" id="ic_warning_24px" y="24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/></svg> </defs>
  35. </svg><!--
  36. ====================================================================================================
  37. -->
  38. <header>
  39. <h1>SVG sprite preview</h1>
  40. <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>
  41. <ul>
  42. <li>Your browser has to <a href="http://caniuse.com/svg-html5" target="_blank">support inline SVG</a> for these techniques to work.</li>
  43. <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>
  44. <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>
  45. </ul>
  46. </header>
  47. <section>
  48. <!--
  49. Inline SVG with embedded sprite
  50. ====================================================================================================
  51. These SVG images make use of fragment identifiers (IDs) and are extracted out of the inline sprite
  52. embedded above. They may be styled via CSS.
  53. -->
  54. <h3>A) Inline SVG with embedded sprite</h3>
  55. <ul>
  56. <li title="ic_error_24px">
  57. <div class="icon-box">
  58. <!-- ic_error_24px -->
  59. <svg viewBox="0 0 24 24" class="svg-ic_error_24px svg-ic_error_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  60. <use xlink:href="#ic_error_24px"></use>
  61. </svg>
  62. </div>
  63. <h2>ic_error_24px</h2>
  64. </li>
  65. <li title="ic_warning_24px">
  66. <div class="icon-box">
  67. <!-- ic_warning_24px -->
  68. <svg viewBox="0 24 24 24" class="svg-ic_warning_24px svg-ic_warning_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  69. <use xlink:href="#ic_warning_24px"></use>
  70. </svg>
  71. </div>
  72. <h2>ic_warning_24px</h2>
  73. </li>
  74. </ul>
  75. <!--
  76. ====================================================================================================
  77. -->
  78. <!--
  79. Inline SVG with external sprite
  80. ====================================================================================================
  81. These SVG images make use of an URL + fragment identifiers (IDs) and refer to the regular external
  82. SVG sprite. They may be styled via CSS. (IE 9-11 with polyfill only)
  83. -->
  84. <h3>B) Inline SVG with external sprite (IE 9-11 with polyfill only)</h3>
  85. <ul>
  86. <li title="ic_error_24px">
  87. <div class="icon-box">
  88. <!-- ic_error_24px -->
  89. <svg viewBox="0 0 24 24" class="svg-ic_error_24px svg-ic_error_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  90. <use xlink:href="svg/sprite.svg#ic_error_24px"></use>
  91. </svg>
  92. </div>
  93. <h2>ic_error_24px</h2>
  94. </li>
  95. <li title="ic_warning_24px">
  96. <div class="icon-box">
  97. <!-- ic_warning_24px -->
  98. <svg viewBox="0 24 24 24" class="svg-ic_warning_24px svg-ic_warning_24px-dims" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  99. <use xlink:href="svg/sprite.svg#ic_warning_24px"></use>
  100. </svg>
  101. </div>
  102. <h2>ic_warning_24px</h2>
  103. </li>
  104. </ul>
  105. <!--
  106. ====================================================================================================
  107. -->
  108. </section>
  109. <footer>
  110. <p>Generated at Wed, 12 Nov 2014 20:00:29 GMT by <a href="https://github.com/jkphl/svg-sprite" target="_blank">svg-sprite</a>.</p>
  111. </footer>
  112. </body>
  113. </html>