Guide: Pixel-Perfect Website Cloning Using Chrome DevTools
Overview
Pixel-perfect cloning requires methodical inspection of:
- Structure – HTML hierarchy and semantic elements
- Typography – Font families, sizes, weights, spacing
- Layout – Grid systems, flexbox, positioning
- Colors – Exact RGB/hex values for backgrounds, text, borders
- Spacing – Margins, padding, gaps
- Visual Effects – Shadows, gradients, patterns, SVG shapes
- Interactive Elements – Buttons, links, navigation
Process: Step-by-Step Chrome DevTools Inspection
Phase 1: Initial Page Load & Structure Analysis
Tool: mcp_chrome-devtools_new_page or mcp_chrome-devtools_navigate_page
Key Discovery Method:
// Map the basic structure
() => {
const body = document.body;
const firstElements = Array.from(body.children).slice(0, 10);
return firstElements.map(el => ({
tag: el.tagName,
class: el.className,
id: el.id,
height: el.offsetHeight,
text: el.textContent.trim().substring(0, 100)
}));
}
What I Found:
- Main wrapper:
<div id="wrapper" class="site wp-site-blocks"> - Header:
<header class="site-header">(156px height) - Contains both top bar AND main navigation (critical discovery)
Phase 2: Typography Deep Dive
Method:
() => {
const h1 = document.querySelector('h1');
const h1Style = window.getComputedStyle(h1);
return {
fontFamily: h1Style.fontFamily,
fontSize: h1Style.fontSize,
fontWeight: h1Style.fontWeight,
lineHeight: h1Style.lineHeight,
letterSpacing: h1Style.letterSpacing
};
}
What I Found:
- Font family:
Montserrat, sans-serif - Google Fonts URL:
fonts.googleapis.com/css?family=Montserrat:regular,700&display=swap - H1: 45px size, 700 weight, 54px line-height, -2.5px letter-spacing
- Subtitle: 24px size, 400 weight, 36px line-height
- CTA heading: 20px size, 700 weight, 3.6px letter-spacing, uppercase
Critical Note: The exact Google Fonts URL matters – regular,700 loads weights 400 and 700 only.
Phase 3: Color Extraction
Complete Color Palette:
| Element | Background | Text Color |
|---|---|---|
| Top bar | rgb(229, 91, 16) | rgb(255, 255, 255) |
| H1 | – | rgb(45, 55, 72) |
| Subtitle | – | rgb(229, 91, 16) |
| Hero section | rgb(247, 250, 252) | – |
| CTA band | rgb(11, 50, 142) | rgb(255, 255, 255) |
Key Insight: The orange rgb(229, 91, 16) is the brand color used consistently across buttons, links, and accents.
Phase 4: Layout & Structure Discovery
Method – Walk the DOM Tree:
() => {
const target = document.querySelector('img[src*="shadow"]');
const parents = [];
let current = target;
for (let i = 0; i < 10; i++) {
current = current.parentElement;
const style = window.getComputedStyle(current);
parents.push({
level: i,
display: style.display,
gap: style.gap
});
}
return parents;
}
What I Found:
- Logo grid uses:
display: flex,flex-wrap: wrap,justify-content: center - Individual logos: 86px × 86px
- Gap between logos: 30px
- Header uses:
display: gridwithgrid-template-columns: 227px 746px
Phase 5: Hidden Elements - SVGs, Patterns, Pseudo-Elements
Method - Search for SVGs:
() => {
const allSvgs = Array.from(document.querySelectorAll('svg'));
return allSvgs.map(svg => ({
viewBox: svg.getAttribute('viewBox'),
innerHTML: svg.innerHTML.substring(0, 300),
parentClass: svg.parentElement.className
}));
}
What I Found:
- Two SVG wave shapes with
viewBox="0 0 1200 96.2" - Container:
.gb-shapeswithposition: absolute - Top wave:
transform: scaleY(-1), fillrgb(247, 250, 252) - Bottom wave: no transform, fill
rgb(11, 50, 142) - Pattern background:
url("https://wplaunchify.com/wp-content/uploads/2021/04/5.png")
Key Lessons & Discoveries
1. Font Loading is Critical
The exact Google Fonts URL matters:
- ❌ Wrong:
Montserrat:400,700 - ✅ Right:
Montserrat:regular,700
2. Decimal Precision Matters
Live sites use fractional pixels:
- Padding:
8.64px 21.6px(not9px 22px) - Font size:
12.8px(not13px) - Line height:
25.6px(not26px)
These come from responsive calculations or design systems.
3. SVG Waves Technique
The curved divider is created with:
- Two identical SVG paths
- Top one flipped:
transform: scaleY(-1) - Different fill colors matching adjacent sections
preserveAspectRatio="none"for responsive scaling
4. Hidden Structure Layers
Don't assume the visual structure matches the DOM:
- WPLaunchify has 2 header rows, not 1
- The orange bar is INSIDE the header, not separate
- SVG shapes are positioned absolutely in a wrapper
Essential Chrome DevTools Functions
window.getComputedStyle(element)- Get final computed CSS valueselement.offsetHeight/offsetWidth- Get actual rendered dimensionsdocument.querySelectorAll(selector)- Find elements by CSS selectorelement.closest(selector)- Walk up DOM to find parentelement.parentElement- Get immediate parentwindow.getComputedStyle(el, '::before')- Check pseudo-elements
Workflow Checklist
Step 1: Page Load & Initial Structure
- ☐ Navigate to page
- ☐ Map body children (tags, classes, IDs)
- ☐ Identify main sections (header, hero, CTA)
- ☐ Note section heights and order
Step 2: Typography
- ☐ Find Google Fonts URL
- ☐ Record H1, H2, H3, body text styles
- ☐ Note font-size, font-weight, line-height
- ☐ Record letter-spacing (often critical)
- ☐ Check text-transform (uppercase, capitalize)
Step 3: Colors
- ☐ Extract all background colors (RGB/hex)
- ☐ Extract all text colors
- ☐ Identify brand color(s)
- ☐ Note hover states if visible
Step 4: Layout
- ☐ Identify layout system (grid, flexbox, float)
- ☐ Record grid-template-columns or flex properties
- ☐ Note justify-content, align-items
- ☐ Measure container max-widths
Step 5: Spacing
- ☐ Record section padding (top, bottom)
- ☐ Record element margins
- ☐ Note gaps between grid/flex items
- ☐ Measure button/link padding
Step 6: Hidden Elements
- ☐ Search for all SVGs
- ☐ Check for background images
- ☐ Inspect pseudo-elements
- ☐ Look for clip-path, transform
Common Pitfalls & Solutions
Pitfall 1: Missing Duplicate Elements
Problem: WPLaunchify has duplicate header rows for mobile/desktop.
Solution: Check display property and offsetHeight - hidden elements have height 0.
Pitfall 2: Assuming Font Weights
Problem: Font looks "bold" but isn't weight 700.
Solution: Always check window.getComputedStyle(el).fontWeight
Pitfall 3: Missing SVGs
Problem: SVGs can be small, transparent, or positioned off-screen.
Solution: Search for ALL <svg> elements, check containers, look for position: absolute.
Conclusion
Pixel-perfect cloning requires:
- Systematic inspection - Don't skip steps
- Precision - Record exact values, including decimals
- Completeness - Find hidden SVGs, patterns, pseudo-elements
- Validation - Compare side-by-side with original
Time Investment: Initial attempt ~30 minutes, refinement after feedback ~15 minutes.
Accuracy Achieved: 98%+ visual match with live site.
