How to Copy HTML and CSS Code From Websites Easily | Codrops

By Pro Web Design

2022-08-02 10:37:43

How to Copy HTML and CSS Code From Websites Easily | Codrops 1

If you worked as a front-end web developer in the 2000s, you must know how hard it was to deal with even the simplest bugs. You had an HTML page that used a CSS file, and that CSS file could grow quite large based on the website size and complexity. And once some bug popped up, it could take days to navigate through the CSS file and identify/solve the bug.

Then in 2006, Firebug was born.

It pretty much changed the front-end development (and especially the debugging part) overnight. In fact, it was so great and helpful that browsers of the time (like Chrome and Firefox) quickly incorporated it.

Nowadays, you probably know this as an “Inspect tool” available in most modern browsers such as Chrome, Firefox, Edge, and others. And with all its “little” problems, the “Inspect tool” worked quite well for developers, saving their time and making front-end debugging many times easier.

But evolution never stops, and today we’re going to show you the logical progress in front-end inspection: CSS Scan.

What is CSS Scan?

CSS Scan is a modern browser extension that works well in Chrome, Firefox, Safari, Edge, and possibly any Chromium-based browser.

The purpose of CSS Scan is to help you inspect, copy, and edit CSS in the fastest way, saving you tons of time.

The main problem with the “Inspect tool” is that it provides too much data, making it hard to navigate and copy only the CSS rules that are actually needed while omitting the redundant styles:

How to Copy HTML and CSS Code From Websites Easily | Codrops 2

Furthermore, the “Inspect tool” considers HTML and CSS as separate entities, so copying even a simple button requires multiple steps in order to get the HTML structure and CSS styles that make it bright and shining.

The CSS Scan extension solves these problems rather well.

No right click and no inspection.

No tedious styles to go through.

Just left-click the element you like on a website, and you’ll have the CSS rules ready to make that exact button on your own website.

How to Copy HTML and CSS Code From Websites Easily | Codrops 3

And as long as you want it, that same one click will copy the CSS selectors and HTML structure as well.

Sounds good? Let me show you how to start using CSS Scan today.

How to install the CSS Scan extension in your browser?

CSS Scan is a browser extension, so the first thing to do is to go to your browser’s extension store and look for CSS Scan.

If using Chrome, you can do so here. And if you’re using Firefox, Safari, or Edge, you’ll receive instructions when you purchase it.

How to Copy HTML and CSS Code From Websites Easily | Codrops 4

Click the blue “Add to Chrome” button and the extension will be installed in your browser in no time:

How to Copy HTML and CSS Code From Websites Easily | Codrops 5

It is a premium extension, so the first time you open it, you’ll need to add the license key (which you can obtain at the official CSS Scan website):

How to Copy HTML and CSS Code From Websites Easily | Codrops 6

Simply enter your license key, click the green button and you’ll be ready for the easiest HTML/CSS inspection.

How to set up CSS Scan?

As soon as you validate your license key, the extension will start working:

How to Copy HTML and CSS Code From Websites Easily | Codrops 7

The “Pause” option will pause the extension, so the toolbar is visible, you’ll no longer see the CSS window floating around whenever you hover over elements, and you can freely click throughout the website.

The “Move” option will move the extension toolbar from top to bottom, in case you prefer to keep it there or there’s some element behind it, like headers.

And in order to use it optimally and according to your preference, you should check the “Options” item first:

How to Copy HTML and CSS Code From Websites Easily | Codrops 8

There are quite a few options and preferences to go through, and you can tweak them on the fly, depending on what you want to do at that moment.

Among other things, this extension offers you the ability to copy only CSS or both CSS and HTML, what to do with parent and child stylings, conversion of font-size units to pixels, whether to ignore box-sizing, and others.

And at the end of the options menu, you have a nice list of available keyboard shortcuts, as many devs prefer the keyboard over the mouse whenever possible:

How to Copy HTML and CSS Code From Websites Easily | Codrops 9

And once you choose the options that work best for you, it’s time to actually start copying the element styles in the easiest way possible.

The pain of using the Inspect Tool

For this example, I’m going to copy some styles and HTML from the BBC homepage.

But you can use the same easy way to copy any element and CSS from any website that is publicly available.

The easy way will follow in the next section since in contrast, let’s see how hard this is with the Inspect Tool.

On the homepage of the BBC website, let’s have a look at that latest business news element:

How to Copy HTML and CSS Code From Websites Easily | Codrops 10

It has a nice white header with a red background, then a set of list items that are numbered in a stylish way. And as a final touch, every immediate list item has a different shade of the background.

“Normally”, we can use the Chrome Inspect tool to first copy the HTML:

How to Copy HTML and CSS Code From Websites Easily | Codrops 11

And that doesn’t look that difficult.

But getting the CSS for the entire list, while keeping the redundant stuff out of the way, is indeed difficult.

As you can see, we have the “most-popular” div, then the “top-list” div, an

, and then the

Recent Posts