CODE & CLONING

Copy a website element’s HTML and CSS

Open Sitepeel’s Pick element tool, select the whole button, card or section, check the preview and copy the code, then fix what it depends on.

A complete card is selected with its parent context and exported as connected HTML and CSS files.
Select a useful component boundary and keep the styles it depends on.

In short

  • Select the whole component, not just the text inside it
  • Watch for fonts, image URLs, inherited styles and parent width
  • You get rendered output, not the original React or Vue source
  • Test it with real content, long labels and a narrow column
On this page5
  1. Step by step
  2. What the copied code depends on
  3. Make it adaptable
  4. When to use another tool
  5. Questions

Step by step

  1. Open Pick element

    Open Sitepeel, choose Pick element and move over the page to find the element you want.

  2. Select the right container

    If only the text is selected but the background comes from a parent, select the enclosing element.

  3. Check the preview

    Make sure it includes the children that define the layout, without pulling in the whole page.

  4. Copy and adapt

    Copy the code, rename classes, swap in your content and replace fixed widths with flexible ones.

  5. Test it in place

    Try realistic content and longer labels, check focus states and confirm links and buttons work.

What the copied code depends on

Dependencies to fix after copying
DependencyWhat to do
External font namesLicense the font and load it in your project
Image URLsHost files you have rights to and update the paths
Inherited stylesCheck the parent for type, color and alignment
Parent widthUse a flexible width so it fits a narrow column
Framework behaviorRebuild props, state and event handlers in your app
HTML & CSS extractor in the Sitepeel interface
HTML & CSS extractor in actionExplore the tool

Make it adaptable

A snippet from a wide desktop page can overflow a narrow column. This hand-written example shows the shape of an adaptable card, not an extracted result.

project-card.cssCSS
.project-card {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 28rem;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
}
.project-card img {
  display: block;
  width: 100%;
  height: auto;
}

When to use another tool

If several elements share the same look, move those decisions into reusable components and tokens.

Pick the Sitepeel tool for the job
You needUse
One button, card or sectionPick element
A whole page snapshotClone page
Design rules without markupDesign MD
Exact sizes and spacingInspect & measure

Questions

Can I copy a React component from another website?

You can copy its rendered HTML and CSS. The original component source, props and state aren’t in that output, so rebuild them in your app.

Why does a copied element look different after I paste it?

It may depend on parent layout, inherited styles, fonts or external assets. Check those, then test it in its new container.

TAKE A CLOSER LOOK

Your next starting point is already on the web.

Inspect it. Understand it. Build something of your own.

Add to ChromeFree installTry the free tools