If I like an element of a site, and I want to implement it into my site, what is the easiest way to do it? Sometimes there is a lot of CSS files, that is hard to follow all of them.
-
10Make sure you actually have permission to use it. – BoltClock Mar 14 '11 at 09:13
-
Agreed. View source to explore how things have been implemented and to learn new techniques, but never just lift the markup wholesale. – Phil Powell Mar 14 '11 at 16:52
9 Answers
UPDATE: As @tank answers below, Chrome version 77 added "Copy Styles" when you right-click on an element in the devtools inspector.
Using Javascript worked best for me. Here's how I did it:
- Open Chrome DevTools console.
Paste this
dumpCSSText
function from this stack overflow answer into the console, and hitEnter
:function dumpCSSText(element){ var s = ''; var o = getComputedStyle(element); for(var i = 0; i < o.length; i++){ s+=o[i] + ':' + o.getPropertyValue(o[i])+';'; } return s; }
When using Chrome, you can inspect an element and access it in the console with the
$0
variable. Chrome also has acopy
command, so use this command to copy ALL the css of the inspected element:copy(dumpCSSText($0));
Paste your CSS wherever you like!

- 18,733
- 3
- 28
- 30
-
4This is a great tip, I love it! I would add that, if you find yourself using this a lot, you can use Dev Tools' little utilized Snippets feature to permanently save it in your browser. You need to run it for every new instance of Dev Tools before using, but it's better than copy and paste. Or, you could make a bookmarklet. Also, I would add a newline "\n" after the property value but that's personal preference. – T Nguyen Jul 02 '18 at 14:49
open Firefox, install Firebug right click on the element you want, choose Inspect element
and then open the Computed
area
you will have ALL STYLES applied to that element
This is valid in Chrome, Safari, Opera and IE with their own development tools
Opera (DragonFly is already installed with Opera)
Firefox (Needs FireBug plugIn)
Internet Explorer (Needs IE Developer Toolbar plugin)
Chrome & Safari (Web Inspector is already part of Chrome and Safari)

- 73,608
- 45
- 233
- 342
Chrome 77 now has Copy styles
in the Context menu on the Inspect Element tab.
Right click on the Element > Inspect > Right click on the element in the opened Elements tab > Copy > Copy styles

- 4,177
- 11
- 45
- 65

- 193
- 1
- 7
-
I get a lot of stuff starting with `--` like `--fusion-audio-max-width-default: 100%;` and `--header_border_color: #e5e5e5;` Is this broken in Chrome? – HMR Jan 09 '20 at 12:07
-
Personally i would pick up the css of the entire website since this can affect the element chosen.
1- Go to console and run this function
function copyCSS(){
let cssStyles = ''
// Started at index 1 for index 0 is browser's user agent stylesheet.
for (let i = 1; i < document.styleSheets.length; i++) {
let style = null
try {
if (document.styleSheets[i]) {
const classes =
document.styleSheets[i].cssRules || document.styleSheets[i].rules
if (classes) style = classes
}
for (const item in style) {
if (style[item].cssText != undefined) cssStyles += style[item].cssText
}
} catch (e) {
continue
}
}
return cssStyles
}
2- Run in console
copy(copyCSS())
You have in your clipboard all the CSS.

- 429
- 1
- 8
- 20
In one word:
Use Firebug to inspect the element, then you can see the cascade. Even better, you can copy and paste right out of FB to a CSS file.
If you want to use other browsers, you can also use their pre-installed developers tools (F12 in IE (requires the IE developers toolbar) right click - inspect element in chrome) or you can use Firebug Lite. :)

- 65,599
- 28
- 144
- 152
-
Firebug is for only one browser, and it's a plugin. Chrome, Safari and Opera already have with their own *firebug* out-of-the-box :) – balexandre Mar 14 '11 at 09:22
-
In chrome/Chromium you can look at computed style. In FF u will need Firebug to see computed style, in Opera use firefly

- 5,038
- 7
- 39
- 51
Use something like FireBug or Chrome's developer tools to inspect the DOM and see what styles are applied to the element in question.

- 428,835
- 81
- 738
- 806
IE8: click F12 --> click "Select element by click" (the white arrow, left most in the icons menu) --> Go back to the web page, click the element you like --> Go back to the Developer Tools page of IE and you'll see the whole style listed to the right.
Others already answered for other browsers. :)

- 66,030
- 26
- 140
- 208
this JS function that will get the CSS of a parent div and all its children:
function getCSS(selector) {
// Get the parent div
const parentDiv = document.querySelector(selector);
// Get the CSS of the parent div
const parentCSS = window.getComputedStyle(parentDiv);
// Get the children of the parent div
const children = parentDiv.querySelectorAll('*');
// Get the CSS of each child and add it to an array
const childrenCSS = Array.from(children).map(child => {
return window.getComputedStyle(child);
});
// Return an object containing the CSS of the parent div and all its children
return {
parent: parentCSS,
children: childrenCSS
};
}
then to use:
getCSS(".home-platform_component"));

- 238
- 1
- 17