码迷,mamicode.com
首页 > 其他好文 > 详细

[SVG] Add an SVG as an Embedded Background Image

时间:2017-02-24 23:37:07      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:.com   can   use   tor   dup   ant   over   require   display   

Learn how to set an elements background image to embedded SVG. This method has an added benefit of not incurring any HTTP requests, as the SVG is simply embedded into the CSS. They can also be resized by changing the width and height of the element containing background image, so it’s easy to create multiple sizes of the same icon using this approach.

If you’re looking for the ability to display icons at different sizes and want to modify the SVG interaction styles (such as on :hover), this is could be a good option. One negative to adding the interaction styles is that it requires you to duplicate selectors and the SVG markup; the more icons you have, the larger your stylesheets will become.

 

Two Rules:

1. The embedded svg image, should use single quote.

2. Should encoder, can use http://meyerweb.com/eric/tools/dencoder/

 

 

[SVG] Add an SVG as an Embedded Background Image

标签:.com   can   use   tor   dup   ant   over   require   display   

原文地址:http://www.cnblogs.com/Answer1215/p/6440621.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!