0

Is there any method or extension to see which CSS rules are applied on a page? For example, span rule does not apply to anything.

<html>
<head>
<style>
    div{
        background: grey;
        line-height: 64px;
        width:64px;
        height:64px;
        text-align:center;
        color:white;
        font-family:verdana;
        font-size:35px;
        border-radius: 50%;
    }
    div:hover{
        background-color:#3b5998;
    }
    span {
        background-color:black;
    }
</style>
</head>
<div>
    f
</div>

If I can see only the rules applied, I can delete unnecessary rules so that, page can load faster.

delinane
  • 135
  • 1
  • 15
  • 1
    Duplicate: http://stackoverflow.com/questions/135657/how-to-identify-unused-css-definitions – Christian Zosel Oct 23 '16 at 14:39
  • 1
    You are supposed to search the internet (use Google) for answers before asking a question here. Try `purify CSS` and `CSS performance` for starters. – tao Oct 23 '16 at 14:41
  • [CSS Dust Me](https://addons.mozilla.org/en-gb/firefox/addon/dust-me-selectors/) is another one, that tells you which CSS rules are not used on a site. – Martin Oct 23 '16 at 14:52
  • There are addons for this, for starters you can use view page source or inspect element. – Abhishek Gurjar Oct 23 '16 at 14:55
  • I ask questions here when I cannot find answers on google or when I don't know how to query on google. So, thanks for the queries! – delinane Oct 23 '16 at 15:07

2 Answers2

-1

Have you tried to Inspect your page? (Ctrl+Shift+i on chrome)

RLin
  • 25
  • 3
  • 1
    While inspecting might work for very small web pages, when dealing with large applications or with frameworks you need better tools for code cleanup. CSS performance is an important issue in today's web only using Inspector you can't get too far. – tao Oct 23 '16 at 14:45
-1

use browser developer tool for shortcuts ctrl+shift+I or f12 or right click and click inspect elements which tag u want to find out..

then click one html tag it show which css is used inside bar

paranjothi
  • 103
  • 6
  • Please see Andrei's comment to [RLin](http://stackoverflow.com/a/40204161/3536236)s answer. – Martin Oct 23 '16 at 14:51