CODE & CLONING

How to download CSS from a website

To download CSS from a website, open DevTools, filter the Network panel by CSS, reload and save each stylesheet from a new tab, or save the files from the Sources panel. For only the rules the page uses, in one file, paste the link into a free Website to HTML tool and take its styles.css.

“Only the CSS the page uses.” Three stylesheets, main.css, vendor.css and theme.css, mostly grey unused rules with a few highlighted ones, merge into one styles.css of only the used rules.
The rules the page uses, from every stylesheet, in one file.

In short

  • A site’s CSS is spread over several files, plus style tags
  • Most of it is minified, and much of it is unused on any one page
  • Website to HTML keeps only the rules the page uses, in one file
  • To copy one button or card, copy that element’s CSS instead
On this page6
  1. Step by step
  2. Where a website’s CSS lives
  3. Make minified CSS readable
  4. Keep only the CSS the page uses
  5. Copy the CSS of one element
  6. Questions

Step by step

  1. Open DevTools

    Press F12 (Cmd+Option+I on a Mac) and open the Network panel.

  2. List the stylesheets

    Choose the CSS filter and reload. Each row is a stylesheet the page loads.

  3. Save each file

    Right-click a row, choose Open in new tab, then press Ctrl+S (Cmd+S) to save it.

  4. Or get one clean file

    Paste the link into Website to HTML and download styles.css with the rules the page uses.

Where a website’s CSS lives

Where CSS comes from on a page, and how to save each kind
WhereWhat it holdsHow to save it
Linked stylesheets<link rel="stylesheet"> files, often with hashed namesNetwork with the CSS filter, or Sources
<style> tagsCSS written into the HTML, common with frameworksCopy the tag’s contents in Elements
Inline stylesA style attribute on one elementElements, on that element
CSS added by scriptsStyles a script adds while the page runsOnly in the rendered page: Elements or Website to HTML
@import filesStylesheets another stylesheet pulls inThey show in Network too
Website cloner in the Sitepeel interface
Website cloner in actionExplore the tool

Make minified CSS readable

  • In Sources, open the .css file and press the {} button to format it.
  • Or run it through Prettier: npx prettier --write main.css.
  • Class names like .a1b2c3 come from build tools. The names mean little; the values are what you want.

Keep only the CSS the page uses

Big sites ship one stylesheet for every page, so most rules don’t apply to the page you have open. Two ways to trim it:

  • Chrome’s Coverage panel (Ctrl+Shift+P, type coverage) marks the used and unused rules in each file.
  • Website to HTML gathers the rules the page uses from every stylesheet into one styles.css, with media queries and @font-face kept.

Copy the CSS of one element

Need one button or card, not the whole stylesheet? Right-click the element in Elements and choose Copy > Copy styles. Then check the fonts, variables and parent layout it depends on.

Questions

How do I download the CSS from a website?

Open DevTools, choose Network, pick the CSS filter and reload. Open each stylesheet in a new tab and save it. For one file with only the rules the page uses, use a Website to HTML tool.

How do I extract only the CSS a page uses?

Paste the link into a Website to HTML tool, which keeps only the rules the page uses in one styles.css. In Chrome, the Coverage panel shows which rules are used, but you cut the rest yourself.

Why is the CSS all on one line?

It is minified so it loads faster. Open it in DevTools Sources and press the {} button, or run it through a formatter like Prettier.

How do I copy the CSS of one element?

Right-click it and choose Inspect, then right-click the element in Elements and pick Copy > Copy styles. Check its fonts, variables and parent layout before you paste it elsewhere.

Can I reuse a website’s CSS?

CSS is code someone wrote, so it is protected like other code. Study it and learn from its values, then write your own rules for your project.

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