是的,这是可能的.试试这个:
body { background-image:
url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10'><linearGradient id='gradient'><stop offset='10%' stop-color='%23F00'/><stop offset='90%' stop-color='%23fcc'/> </linearGradient><rect fill='url(%23gradient)' x='0' y='0' width='100%' height='100%'/></svg>");
}
(请注意,SVG内容需要url转义才能工作,例如,#
被替换为%23
.)
This works in IE 9 (which supports SVG)美元.数据URL也可以在较旧版本的IE中使用(有限制),但它们本身并不支持SVG.