is there any efficient way to scan the id & class name in css file? there are many css file in my web app and now i have to add some more css file. I often get stuck to define the ID & Class name which is already defined in another css file and it causes problem during testing.
I am really tired of keep changing the id & class name. can some one give me any tips to sort it out.
@Edit : suppose there are two css files in a web app old_1.css & old_2.css
old_1.css #id_1 {width:100%;height:100%; .... }
#id_2 { width:50%; height:50%; .... }
old_2.css #id_3 {width:70%;height:70%; .... }
#id_4 { width:30%; height:30%; .... }
Now i am creating a new css file new_1.css and by mistake i wrote the simmilar id of old css file. this is where i get stuck and i want to avoid to rewrite the same ID.
new_1.css #id_1 {width:80%;height:80%; .... } // this id is already declared in old css file
Rather than ensuring each CSS class name is unique, ensure that the CSS styles cannot clash by including parent elements in your CSS. This is better for structure:
HTML:
CSS:
This will ensure that only
div‘s withinner_divclass will be given the stylecolor:redwhere they are contained in adivwith the classsection1. Likewise, onlydiv‘s withinner_divwill be styledcolor:bluewhere they are contained in adivwith the classsection2.Using this format should prevent you from ever having duplicate class names as you can define as far as you like, for example if I was applying a style to a span tag displaying the date for a news article I’d use:
This is a lot easier to read, and a lot less likely to be duplicated than:
Otherwise, like @Ant has stated, use a good HTML editor software and do a Find on the classes and IDs used.