我是使用SVG的新手,并使用http://svgcircus.com/
创建了这个当我在浏览器(chrome)中打开svg文件时,它是动画的,但当我将其作为背景导入时 - 它似乎没有动画。
#hero{
height: 500px;
width: 500px;
background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IS0tIEdlbmVyYXRvcjogU1ZHIENpcmN1cyAoaHR0cDovL3N2Z2NpcmN1cy5jb20pIC0tPgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIGlkPSJTVkctQ2lyY3VzLTVjMzI0ODU3LTlmODUtM2EwNC03ZGM0LTk5MWZjMDUyNjk0YiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCI+PGNpcmNsZSBpZD0iYWN0b3JfNiIgY3g9Ijg2IiBjeT0iNjEiIHI9IjEiIG9wYWNpdHk9IjEiIGZpbGw9IiMwMkZGRjEiIGZpbGwtb3BhY2l0eT0iMSIgc3Ryb2tlPSIjMDJGRkYxIiBzdHJva2Utd2lkdGg9IjEiIHN0cm9rZS1vcGFjaXR5PSIxIiBzdHJva2UtZGFzaGFycmF5PSIiPjwvY2lyY2xlPjxjaXJjbGUgaWQ9ImFjdG9yXzUiIGN4PSI2MiIgY3k9IjM5IiByPSIxIiBvcGFjaXR5PSIxIiBmaWxsPSIjMDJGRkYxIiBmaWxsLW9wYWNpdHk9IjEiIHN0cm9rZT0iIzAyRkZGMSIgc3Ryb2tlLXdpZHRoPSIxIiBz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