<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Intricate Nested HTML and SVG</title>
<style>
body {
background: linear-gradient(135deg, #f0f4f8, #d9e2ec);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 40px;
}
.container {
max-width: 900px;
margin: auto;
background: white;
box-shadow: 0 8px 24px rgba(0,0,0,0.1);
border-radius: 15px;
padding: 35px;
display: flex;
flex-wrap: wrap;
gap: 40px;
justify-content: center;
}
.box {
background: #fefefe;
border-radius: 12px;
box-shadow: 0 4px 16px rgba(0,0,0,0.06);
padding: 25px;
width: 260px;
position: relative;
}
.box h2 {
font-weight: 700;
color: #334e68;
margin-bottom: 18px;
text-align: center;
}
.decorative-svg {
display: block;
margin: 0 auto 20px auto;
filter: drop-shadow(0 2px 2px rgba(0,0,0,0.07));
}
.html-elements {
border-top: 1px solid #cbd5e1;
padding-top: 12px;
font-size: 15px;
color: #627d98;
line-height: 1.5;
}
/* Stylish nested html elements */
.html-elements ul {
padding-left: 18px;
margin-top: 12px;
}
.html-elements ul li {
margin-bottom: 6px;
}
.highlight {
background: #d1e8ff;
padding: 2px 6px;
border-radius: 4px;
font-weight: 600;
color: #0b63ce;
}
</style>
</head>
<body>
<div class="container">
<div class="box">
<h2>Outer SVG Layer</h2>
<svg class="decorative-svg" width="240" height="240" viewBox="0 0 240 240" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Nested circles and squares">
<rect width="240" height="240" rx="30" ry="30" fill="#e3f2fd" />
<!-- Inner Nested SVG #1 -->
<svg x="40" y="40" width="160" height="160" viewBox="0 0 160 160">
<circle cx="80" cy="80" r="70" fill="#90caf9" stroke="#42a5f5" stroke-width="6" />
<!-- Nested SVG circle with pattern -->
<svg x="40" y="40" width="80" height="80" viewBox="0 0 80 80">
<defs>
<pattern id="dots" patternUnits="userSpaceOnUse" width="10" height="10">
<circle cx="2" cy="2" r="1.5" fill="#1565c0" />
<circle cx="7" cy="7" r="1.5" fill="#1565c0" />
</pattern>
</defs>
<rect width="80" height="80" fill="url(#dots)" rx="12" ry="12"/>
<circle cx="40" cy="40" r="34" fill="none" stroke="#0d47a1" stroke-width="4" />
</svg>
</svg>
</svg>
<div class="html-elements">
<p>This box shows an <span class="highlight">intricately nested SVG</span> with multiple layers:</p>
<ul>
<li>Base <code>rect</code> with rounded corners</li>
<li>Second-level <code>circle</code> with stroke</li>
<li>Third-level nested <code>svg</code> containing a patterned <code>rect</code> and a circle stroke</li>
</ul>
</div>
</div>
<div class="box">
<h2>Styled HTML Elements</h2>
<div class="html-elements">
<p>Outside of SVG, HTML elements are styled independently:</p>
<ul>
<li><strong>Box shadows</strong> create subtle depth</li>
<li><em>Rounded corners</em> soften edges</li>
<li>Text uses custom <code>font-family</code> and <code>colors</code></li>
<li>Consistent <code>margin</code> and <code>padding</code> for neat spacing</li>
</ul>
<p><span class="highlight">Flexible layout</span> with <code>flex-wrap</code> and gap between boxes helps responsiveness.</p>
</div>
<svg class="decorative-svg" width="200" height="120" viewBox="0 0 200 120" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Nested stars and polygons">
<!-- Background -->
<rect width="200" height="120" fill="#fff8e1" rx="15" ry="15" />
<svg x="20" y="18" width="160" height="84" viewBox="0 0 160 84">
<polygon points="80,0 95,55 150,55 105,85 120,140 80,110 40,140 55,85 10,55 65,55" fill="#ffb300" stroke="#f57c00" stroke-width="4"/>
<!-- Nested star shapes -->
<svg x="50" y="20" width="60" height="44" viewBox="0 0 60 44">
<path d="M30 0 L36 18 H54 L39 29 L45 47 L30 36 L15 47 L21 29 L6 18 H24 Z" fill="#ffa726" stroke="#ef6c00" stroke-width="2"/>
</svg>
</svg>
</svg>
</div>
<div class="box">
<h2>Complex Nested Structure</h2>
<svg class="decorative-svg" width="260" height="260" viewBox="0 0 260 260" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Intricate nested shapes with multiple transforms">
<rect width="260" height="260" fill="#f3e5f5" rx="30" ry="30"/>
<!-- First nested svg with group and transform -->
<svg x="30" y="30" width="200" height="200" viewBox="0 0 200 200">
<g transform="rotate(15 100 100)">
<rect x="20" y="20" width="160" height="160" fill="#ce93d8" rx="25" ry="25" />
<!-- Nested svg with circle pattern -->
<svg x="40" y="40" width="120" height="120" viewBox="0 0 120 120">
<defs>
<pattern id="circlesPattern" patternUnits="userSpaceOnUse" width="15" height="15" patternTransform="rotate(45)">
<circle cx="4" cy="4" r="3" fill="#7b1fa2" />
<circle cx="11" cy="11" r="3" fill="#7b1fa2" />
</pattern>
</defs>
<rect width="120" height="120" fill="url(#circlesPattern)" rx="20" ry="20" />
<!-- Deep nested svg with ellipse and nested rect -->
<svg x="30" y="30" width="60" height="60" viewBox="0 0 60 60">
<ellipse cx="30" cy="30" rx="28" ry="20" fill="#ba68c8" stroke="#6a1b9a" stroke-width="3" />
<svg x="15" y="15" width="30" height="30" viewBox="0 0 30 30">
<rect width="30" height="30" fill="#a568b2" rx="8" ry="8" transform="rotate(25 15 15)" />
</svg>
</svg>
</svg>
</g>
</svg>
</svg>
<div class="html-elements" style="margin-top: 22px;">
<p>This is a highly nested SVG structure with multiple groups and transformations. Outside the SVG:</p>
<ul>
<li>The container box rounds corners and adds padding/shadow for separation</li>
<li>Text is separate enabling accessibility and flexible styling</li>
<li>Combining <code>SVG transforms</code> with nested <code>patterns</code> and shapes</li>
</ul>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Intricate Nested HTML Styling</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #f0f4f8;
margin: 40px;
display: flex;
justify-content: center;
}
.container {
max-width: 900px;
margin: auto;
background: white;
box-shadow: 0 8px 24px rgba(0,0,0,0.1);
border-radius: 15px;
padding: 35px;
display: flex;
gap: 40px;
flex-wrap: wrap;
justify-content: center;
}
.box {
background: #fefefe;
border-radius: 12px;
box-shadow: 0 4px 16px rgba(0,0,0,0.06);
padding: 25px;
width: 260px;
position: relative;
}
.box h2 {
font-weight: 700;
color: #334e68;
margin-bottom: 18px;
text-align: center;
}
.html-elements {
border-top: 1px solid #cbd5e1;
padding-top: 12px;
font-size: 15px;
color: #627d98;
line-height: 1.5;
}
.html-elements ul {
padding-left: 18px;
margin-top: 12px;
}
.html-elements ul li {
margin-bottom: 6px;
}
.highlight {
background: #d1e8ff;
padding: 2px 6px;
border-radius: 4px;
font-weight: 600;
color: #0b63ce;
}
</style>
</head>
<body>
<div class="container">
<div class="box">
<h2>Outer SVG Layer</h2>
<div class="html-elements">
<p>This box shows an <span class="highlight">intricately nested SVG</span> with multiple layers:</p>
<ul>
<li>Base <code>rect</code> with rounded corners</li>
<li>Second-level <code>circle</code> with stroke</li>
<li>Third-level nested <code>svg</code> containing a patterned <code>rect</code> and a circle stroke</li>
</ul>
</div>
</div>
<div class="box">
<h2>Styled HTML Elements</h2>
<div class="html-elements">
<p>Outside of SVG, HTML elements are styled independently:</p>
<ul>
<li><strong>Box shadows</strong> create subtle depth</li>
<li><em>Rounded corners</em> soften edges</li>
<li>Text uses custom <code>font-family</code> and <code>colors</code></li>
<li>Consistent <code>margin</code> and <code>padding</code> for neat spacing</li>
</ul>
<p><span class="highlight">Flexible layout</span> with <code>flex-wrap</code> and gap between boxes helps responsiveness.</p>
</div>
</div>
<div class="box">
<h2>Complex Nested Structure</h2>
<div class="html-elements" style="margin-top: 22px;">
<p>This is a highly nested SVG structure with multiple groups and transformations. Outside the SVG:</p>
<ul>
<li>The container box rounds corners and adds padding/shadow for separation</li>
<li>Text is separate enabling accessibility and flexible styling</li>
<li>Combining <code>SVG transforms</code> with nested <code>patterns</code> and shapes</li>
</ul>
</div>
</div>
</div>
</body>
</html>
<svg width="260" height="260" viewBox="0 0 260 260" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Intricate nested shapes with multiple transforms">
<rect width="260" height="260" fill="#f3e5f5" rx="30" ry="30"/>
<!-- First nested svg with group and transform -->
<svg x="30" y="30" width="200" height="200" viewBox="0 0 200 200">
<g transform="rotate(15 100 100)">
<rect x="20" y="20" width="160" height="160" fill="#ce93d8" rx="25" ry="25" />
<!-- Nested svg with circle pattern -->
<svg x="40" y="40" width="120" height="120" viewBox="0 0 120 120">
<defs>
<pattern id="circlesPattern" patternUnits="userSpaceOnUse" width="15" height="15" patternTransform="rotate(45)">
<circle cx="4" cy="4" r="3" fill="#7b1fa2" />
<circle cx="11" cy="11" r="3" fill="#7b1fa2" />
</pattern>
</defs>
<rect width="120" height="120" fill="url(#circlesPattern)" rx="20" ry="20" />
<!-- Deep nested svg with ellipse and nested rect -->
<svg x="30" y="30" width="60" height="60" viewBox="0 0 60 60">
<ellipse cx="30" cy="30" rx="28" ry="20" fill="#ba68c8" stroke="#6a1b9a" stroke-width="3" />
<svg x="15" y="15" width="30" height="30" viewBox="0 0 30 30">
<rect width="30" height="30" fill="#a568b2" rx="8" ry="8" transform="rotate(25 15 15)" />
</svg>
</svg>
</svg>
</g>
</svg>
</svg>