css - How to manipulate SVG background image with JavaScript -
i want remove viewbox
property of root svg
element in background image javascript. how that?
.box { background-image: url(http://upload.wikimedia.org/wikipedia/commons/8/86/cc-logo.svg); background-repeat: no-repeat; background-size: auto auto; width: 300px; height: 150px; border: 1px solid; }
<div class="box"> stretch background </div>
here first few characters svg file.
<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewbox="0 0 512 123">
you can use svg fragment identifier viewbox(none)
change url to
http://upload.wikimedia.org/wikipedia/commons/8/86/cc-logo.svg#svgview(viewbox(none))
this work in firefox (and did work in opera 12). not sure how many other uas support viewbox(none) svg 1.2 tiny though.
Comments
Post a Comment