Default background color of SVG root element

后端 未结 6 1127
一生所求
一生所求 2020-11-29 17:30

I\'d like to set a default background color for the entire SVG document, to red for example.

/*          


        
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 18:16

    Let me report a very simple solution I found, that is not written in previous answers. I also wanted to set background in an SVG, but I also want that this works in a standalone SVG file.

    Well, this solution is really simple, in fact SVG supports style tags, so you can do something like

    
      
      hello
    
    

提交回复
热议问题