Sure! Below is an HTML file containing multiple independent nested SVG elements. The SVGs include weird/uncommon dimension units (like ch, ex, vw, %, mm, pt, pc, in) and some of them randomly have viewBox attributes while others intentionally omit them. The SVG shapes inside are varied and somewhat "weird" to visually distinguish them.
This setup can be used for testing SVG parsing/rendering with various units and viewBox presence or absence.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Nested Weird SVGs Test</title>
<style>
body {
background: #222;
color: #eee;
font-family: monospace, monospace;
display: flex;
flex-wrap: wrap;
gap: 2ch;
padding: 2ch;
}
svg {
border: 1px solid #555;
background: #111;
}
</style>
</head>
<body>
<!-- Outer SVG wrapping a nested SVG (nested may have weird units or missing viewBox) -->
<svg width="30ch" height="20ex" viewBox="0 0 300 200" style="background:#400;">
<!-- Nested SVG with px but no viewBox -->
<svg x="50px" y="40px" width="150px" height="100px" style="background:#0a0;">
<circle cx="75" cy="50" r="40" fill="#0f0" stroke="#030" stroke-width="4" />
<text x="75" y="55" font-size="18px" text-anchor="middle" fill="#060">No ViewBox</text>
</svg>
<!-- Nested SVG with vw and viewBox -->
<svg x="5vw" y="10vw" width="20vw" height="15vw" viewBox="0 0 100 75" style="background:#044;">
<rect x="10" y="10" width="80" height="55" fill="lime" stroke="darkgreen" stroke-width="5" />
<path d="M10 70 Q50 10 90 70" stroke="yellow" stroke-width="3" fill="none" />
</svg>
</svg>
<!-- Independent SVG with % dimensions and missing viewBox -->
<svg width="30%" height="15%" style="background:#220;">
<ellipse cx="50%" cy="50%" rx="40%" ry="30%" fill="#fa0" stroke="#a50" stroke-width="4" />
<text x="50%" y="55%" font-size="20" text-anchor="middle" fill="#520">PercentUnits</text>
</svg>
<!-- Independent SVG with mm dimensions and viewBox -->
<svg width="80mm" height="60mm" viewBox="0 0 800 600" style="background:#004;">
<polygon points="100,10 40,180 190,60 10,60 160,180" fill="#08f" stroke="#04a" stroke-width="6"/>
<text x="400" y="300" font-size="40" text-anchor="middle" fill="#acf">ViewBox mm</text>
</svg>
<!-- Nested SVG with pt dimensions missing viewBox -->
<svg width="250pt" height="150pt" style="background:#202">
<svg x="20pt" y="30pt" width="200pt" height="120pt" style="background:#333">
<line x1="0" y1="0" x2="200" y2="120" stroke="#e00" stroke-width="8" />
<line x1="200" y1="0" x2="0" y2="120" stroke="#0e0" stroke-width="8" />
<text x="100" y="60" font-size="24" text-anchor="middle" fill="#eee">Cross PT</text>
</svg>
</svg>
<!-- Independent SVG with pc units and viewBox -->
<svg width="5pc" height="3pc" viewBox="0 0 500 300" style="background:#050;">
<circle cx="250" cy="150" r="140" stroke="lime" stroke-width="14" fill="none"/>
<circle cx="250" cy="150" r="100" fill="lime" />
<circle cx="250" cy="150" r="50" fill="#0a0" />
<text x="250" y="160" font-size="48" text-anchor="middle" fill="#030">PC</text>
</svg>
<!-- Independent SVG with in units and missing viewBox -->
<svg width="3in" height="2in" style="background:#222;">
<rect x="0.5in" y="0.5in" width="2in" height="1in" fill="#333" stroke="#aaa" stroke-width="0.1in"/>
<text x="1.5in" y="1.25in" font-size="0.4in" text-anchor="middle" fill="#ccc">Inches</text>
</svg>
<!-- Nested SVG with em units mixed with px and no viewBox -->
<svg width="15em" height="10em" style="background:#440;">
<svg x="2em" y="1em" width="10em" height="6em" style="background:#440a0a">
<rect width="10em" height="6em" fill="#a04" />
<circle cx="5em" cy="3em" r="2em" fill="#f08" stroke="#801" stroke-width="0.2em" />
<text x="5em" y="3.5em" font-size="1.2em" fill="#ffe" text-anchor="middle">em Mixed</text>
</svg>
</svg>
</body>
</html>
Explanation:
- There are multiple independent and nested SVG elements.
- SVG
width and height use weird or uncommon units:
ch (width of the "0" character)
ex (height of the lowercase "x")
vw (viewport width)
%
mm (millimeters)
pt (points)
pc (picas)
in (inches)
em (font-relative unit)
- Some SVGs include
viewBox, others don't — chosen randomly.
- Shapes inside SVGs vary: circles, ellipses, rectangles, polygons, paths, lines, and text.
- The background colors and stroke colors are chosen for distinct visualization on a dark background.
- SVG elements are nested inside other SVGs for complexity.
Open this file in modern browsers to test how they handle these weird dimension units and the (sometimes missing) viewBox attribute along with nested SVG structures. Let me know if you'd like me to add more weird units or further complexity!