PageRip · Guide

How to copy HTML and CSS from a website.

Copying the HTML takes two clicks. The hard part is what comes after: you paste it and get plain, unstyled text, because the CSS lives somewhere else. Here are the three ways to do it by hand in Chrome, what each leaves behind, and a way to copy an element with its CSS in one step.

By hand, in Chrome.

1. View page source

Right-click the page and choose View page source, or press Ctrl+U (⌘⌥U on a Mac). You get the HTML the server sent for the whole page.

What it leaves behind: anything scripts added after the page loaded. The source includes embedded styles and links to external stylesheets, whose rules are in separate files.

2. Copy an element from Inspect

Right-click the part you want and choose Inspect. In the Elements panel, right-click the highlighted element and choose Copy › Copy outerHTML. This gives you the element’s current DOM markup.

What it leaves behind: CSS rules outside the selected markup. Class names and inline styles come along. Relative image and link addresses may resolve differently when pasted into another site.

3. Copy the CSS from the Styles tab

With the element selected, the Styles tab lists the rules that apply to it. Right-click a property and choose Copy rule or Copy all declarations.

What it leaves behind: Copy rule and Copy all declarations work on the selected rule. Copy any separate rules for child elements or hover states, along with any media queries or variable definitions the component uses.

Why the pasted code looks wrong.

  • The CSS didn’t come with it. The HTML carries class names; the rules are in stylesheets.
  • You copied too much or too little CSS. A whole stylesheet is thousands of rules you don’t need; one element’s rules miss its children.
  • The responsive rules are missing. Values copied from the Computed tab are what the element looks like at this window width only.
  • Variables and fonts point at the old site. var(--brand) means nothing without its definition, and a font file may refuse to load from another address.
  • Relative addresses broke. /img/logo.svg now points at your site, not theirs.

Capture the element and its CSS with PageRip.

PageRip is a free Chrome extension that copies scoped HTML and the CSS rules it can read for your selection.

  1. Click the PageRip toolbar button and pick the element on the page.
  2. Select Captured · Review to open the side panel. Look at the code, the preview, and the Report.
  3. Choose HTML + CSS, JSX + CSS, or Inline snapshot, and copy.

What you get that the manual ways don’t:

  • Only the rules that match your selection, under one wrapper class.
  • The authored CSS, with its original units, variables, media queries, and hover and focus rules, where the stylesheet is readable.
  • Relative addresses made absolute.
  • A Report of known capture gaps, such as a blocked font or an unreadable stylesheet, and what to try next.
The Fieldnotes plan card is visible in Chrome next to its captured markup and authored CSS in PageRip.
The plan card beside its captured HTML and authored CSS.
Inspect screenshot

Scroll to inspect the original window. The view starts at the side panel.

The Fieldnotes plan card is visible in Chrome next to its captured markup and authored CSS in PageRip.
Open full-size image

What no copy gives you.

The export preserves markup and styling. Rebuild any JavaScript-driven actions the component needs. PageRip’s JSX output converts the markup’s syntax. Write React components and logic separately.

Capture an element from your open Chrome tab. Whole-page capture is best effort.

Handing the code to an AI coding tool.

Copy for AI puts the HTML, the CSS, where it came from, the capture width, and the gaps in one block you can paste into a prompt. Save for agent writes the same thing as a file in your project. More on working with coding agents.

Copy the element with its CSS.

PageRip is a free Chrome extension. Pick an element, review the code, and check the Report for known gaps.

Google Chrome is a trademark of Google LLC. Other product names belong to their owners; PageRip is not affiliated with them.