How to get css from specified element of web page

12.8k Views Asked by At

I always wanted to know how to get css code from specified element of a web page Some web sites have a elements that I like and want to add into my localhost page, for example: menu bar.I use inspect element in Google Chrome and I know how to get html code but now css of the element. I looked at apple.com and I want to add that menu bar to my localhost sites.This is class for menu bar <div class="globalnav-wrapper">

Can you help me to get css code of this menu?My english is not got at all but I think you understand me.

3

There are 3 best solutions below

0
On
  1. if you are using chrome:-

    $('div[class=globalnav-wrapper]')

  2. If you are using Firefox then download firebug and firepath and then click on inspect with firepath and select CSS in dropdown of element page and write:-

    div[class=globalnav-wrapper]

    firefox is easier and better than chrome in finding the element from the webpage.

2
On

Right click on the particular position and click "Inspect element" . In browser bottom you can see the selected div and right side can see the css. If you use firefox it will give more options

  globalnav-wrapper {
 position: absolute;
  z-index: 9998;
 top: 0;
 left: 50%;
margin: 18px 0 0 -512px;
width: 1024px;
}
0
On

navigate to resources tab after pressing F12 in chrome and then expand directory tree there you will see css right click on it and choose save or save as