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

  • Home
  • SEARCH
  • 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 7667035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:59:38+00:00 2026-05-31T14:59:38+00:00

I know we can provide styling and positioning in CSS for text box, text

  • 0

I know we can provide styling and positioning in CSS for text box, text area, buttons etc. using “Class” , “Id” etc. attributes to identifying an element.

My question is:
How do we decide when to use a particular attribute?
Is there any advantage of using one over other (class vs Id vs other)?
Why do we have multiple ways of identifying elements? Why not have one standard way to identifying such as, lets say “Id”?

Thanks in advance

  • 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-31T14:59:40+00:00Added an answer on May 31, 2026 at 2:59 pm

    You can’t use ID everywhere because only one element is allowed to have a given ID, so if you want to apply the same style to five different elements, you’d have to create five different rules, which is pointless.

    It’s usually best to use a baseline definition for how you want certain element types to appear generally (links, lists, tables, etc.). Then if you have specific places where you want those elements to have different styles, apply a class to an element to identify that place (“navigation-bar”, e.g.), and use custom styles to modify the behavior of elements within that area:

    li {/* How you generally want list items to appear */}
    .navigation-bar li {/* How you want list items to appear in the nav bar */}
    

    Due to the way the styles “cascade”, properties set by the second rule will override the properties set by the first because the second selector is more specific.

    As far as why there are multiple ways available to select an element, it’s because they’re pretty much all useful at one point or another. CSS helps reduce maintenance costs because you don’t have to repeat the same styling information in a bunch of different places. It can only do this if you can come up with a rule that makes it possible to match the elements you want in a variety of different situations.

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

Sidebar

Related Questions

I know that this is subjective and all, but still, can you provide some
I have a query that I know can be done using a subselect, but
I know I can do most of this by hacking Trac and using Git
Anyone know (or can provide) a programming/XAML example with WPF of a image collection
I'd like to know if anybody can provide a step-by-step how to on how
Can someone provide an example of drawing an iPhone-like turning wheel using Core Graphics
This is something I know can be done somehow , because I've done it
You can know if the event stack is empty calling the gtk.events_pending() method, but
I know you can look at the row.count or tables.count, but are there other
I know you can do redirection based on the domain or path to rewrite

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.