Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6228889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:27:58+00:00 2026-05-24T09:27:58+00:00

is there any efficient way to scan the id & class name in css

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:28:00+00:00Added an answer on May 24, 2026 at 9:28 am

    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:

    <div class="section1">
        <div class="inner_div">
    
        </div>
    </div>
    <div class="section2">
        <div class="inner_div">
    
        </div>
    </div>
    

    CSS:

    .section1 {
    
    }
        .section1 .inner_div {
             color:red;
        }
    
    .section2 {
    
    }
        .section2 .inner_div {
             color:blue;
        }
    

    This will ensure that only div‘s with inner_div class will be given the style color:red where they are contained in a div with the class section1. Likewise, only div‘s with inner_div will be styled color:blue where they are contained in a div with the class section2.

    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:

    .main_container .news .article .details span.date {}
    

    This is a lot easier to read, and a lot less likely to be duplicated than:

    .news_article_date {}
    

    Otherwise, like @Ant has stated, use a good HTML editor software and do a Find on the classes and IDs used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If we have an array of integers, then is there any efficient way other
I am wondering any efficient way to hide our Silverlight code. I know there
Is there any way to check whether a file is locked without using a
I am building a website on top of nhibernate. Is there any efficient way
Is there any efficient way to fetch texture data in a random way? That
Is there any efficient way to convert an NSDate to RFC 2822 Date format
We have a one Java Swing app. Now there is one requirement that it
Is there any efficient way (maybe by abusing the gcc preprocessor?) to get a
Are there any efficient bitwise operations I can do to get the number of
Is there any speed- and cache-efficient implementations of trie in C/C++? I know what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.