Here are 10 independent weird SVG code snippets with unusual dimension units and randomly included or omitted viewBox properties. These are great for testing SVG rendering and behavior with uncommon setups:
1. Width in em, height missing, with viewBox
xml Copy code
<svg width="15em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 50">
<rect width="100" height="50" fill="orange"/>
</svg>
2. Width in vh, height in vw, no viewBox
xml Copy code
<svg width="20vh" height="10vw" xmlns="http://www.w3.org/2000/svg">
<circle cx="50" cy="50" r="40" fill="blue"/>
</svg>
3. Width and height in %, with viewBox
xml Copy code
<svg width="50%" height="30%" viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
<ellipse cx="100" cy="50" rx="80" ry="40" fill="green"/>
</svg>
4. Width in mm, height missing, no viewBox
xml Copy code
<svg width="40mm" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="0" x2="100" y2="100" stroke="red" stroke-width="5"/>
</svg>
5. Width and height in in, with viewBox
xml Copy code
<svg width="3in" height="2in" viewBox="0 0 300 200" xmlns="http://www.w3.org/2000/svg">
<polygon points="150,10 250,190 50,190" fill="purple"/>
</svg>
6. Width in pt, height in pc, with viewBox
xml Copy code
<svg width="300pt" height="10pc" viewBox="0 0 300 120" xmlns="http://www.w3.org/2000/svg">
<text x="150" y="60" font-size="40" text-anchor="middle" fill="black">Weird</text>
</svg>
7. Width in ch, height in ex, no viewBox
xml Copy code
<svg width="30ch" height="10ex" xmlns="http://www.w3.org/2000/svg">
<rect x="10" y="10" width="80" height="40" fill="cyan" />
</svg>
8. Width and height in px as floats, no viewBox
xml Copy code
<svg width="123.45px" height="67.89px" xmlns="http://www.w3.org/2000/svg">
<circle cx="60" cy="30" r="25" fill="magenta"/>
</svg>
9. No dimensions at all, with viewBox
xml Copy code
<svg viewBox="0 0 400 200" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="400" height="200" fill="lightgray"/>
<text x="200" y="100" font-size="50" text-anchor="middle" fill="black">No dims</text>
</svg>
10. Width in %, height in vh, no viewBox
xml Copy code
<svg width="80%" height="15vh" xmlns="http://www.w3.org/2000/svg">
<line x1="0" y1="0" x2="300" y2="150" stroke="orange" stroke-width="8"/>
</svg>
Notes:
Units used: em, vh, vw, %, mm, in, pt, pc, ch, ex, px
Some SVGs are missing height or width attributes.
viewBox property is randomly included or omitted.
Shapes and elements inside SVGs are simple for clarity.
Use these to test how different browsers and viewers handle weird SVG dimension units and viewBox behaviors. If you want more or SVGs with other weird properties, just ask!