SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Locating duplicate selectors

    Hello,

    Does anyone know a way to locate duplicate selectors in a CSS file? Perhaps with a Firefix add-on? I have been given a mess of a stylesheet and I need to remove all the duplicate selectors. What is the best way to do this?

    Thanks!

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    James has a useful utility here that might fit the bill:

    http://www.sitepoint.com/dustmeselectors/welcome/?v=2.0

  3. #3
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is a useful utility but it does not identify duplicate selectors. Any other ideas?

  4. #4
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    I'm not exactly sure what you mean by duplicate then.

    The utility above says this:

    Code:
    Shows which selectors have been used, as well as unused.
    In essence finding duplicate selectors doesn't man a lot because its the properties defined by the selectors that are important.

    e.g.
    Code:
    #test {background:red}
    .otherstuff{color:green}
    #test {color:black}
    You can't remove either of the #test selectors because they define different properties.

    There are various CSS optimising tools around that may do what you want although I have never tried them.

    Such as:
    http://csstidy.sourceforge.net/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •