Skip to content

Instantly share code, notes, and snippets.

<svg width="200" height="150" viewbox="0 0 <width> <height>">
<rect x="10" y="20" width="100" height="50" fill="red" stroke="blue" stroke-width="5"/>
</svg>
<svg width=”200” height=”150” viewBox="<min-x>, <min-y>, <width>, <height>”>
<svg width="200" height="150">
<rect x="10" y="20" width="100" height="50" fill="red" stroke="blue" stroke-width="5"/>
</svg>
<rect x="20" y="124" rx="10" ry="10" width="135" height="85"/>
@LarryMatte
LarryMatte / svg-object-2.html
Last active April 12, 2016 01:28
svg-object-2.html
<svg>
<style>
<!-- your css -->
</style>
...
</svg>
<object type="image/svg+xml" data="mySvgFile.svg">
hey hey hey, this is the SVG Fallback! <!-- fallback -->
</object>
<body>
<svg xmlns="http://www.w3.org/2000/svg">
<title>inline SVG</title>
<desc>some example of svg elements</desc>
<path d="M370.699,476.993l-54.176-94.029c-0.109-0.193-0.316-0.312-0.539-0.312h-10.73c-0.223,0-0.429,0.119-0.539,0.312
l-54.223,94.027c-0.11,0.193-0.11,0.432,0,0.624c0.111,0.192,0.318,0.311,0.541,0.311h14.974c0.224,0,0.43-0.118,0.54-0.313
l12.366-21.64l12.455,21.728c0.111,0.193,0.318,0.312,0.54,0.312h37.372c0.224,0,0.43-0.119,0.54-0.312l12.496-21.795l12.411,21.707c0.111,0.195,0.318,0.313,0.541,0.313h14.89c0.223,0,0.428-0.117,0.539-0.311C370.809,477.423,370.811,477.185,370.699,476.993M299.605,463.997l-6.989-12.192h35.956l-6.987,12.192H299.605zM292.616,437.811l6.989-12.195h21.978l6.989,12.195H292.616zM316.982,411.6h-12.71l6.354-11.117L316.982,411.6z"/>
</svg>
<body>
.svg {
background-image: url(mySvgFile.png); /* fallback using a png file */
background-image: url(mySvgFile.svg);
background-size: contain;
display: block;
width: 150px;
height: 50px;
}
<img src="mySvgFile.svg" alt="my SVG file">
<circle cx="85" cy="300" r="68" fill=”blue” style=” fill:red; stroke:blue; stroke-width:10px;/>