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 8221829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:04:13+00:00 2026-06-07T14:04:13+00:00

I have been working with a few examples have been wondering what the benefits

  • 0

I have been working with a few examples have been wondering what the benefits (if any) there are of setting your style by one specific element or attaching an id to it and setting it via that?
For example if we have this table:

<table>
    <tbody>
        <tr class="cat1">
            <th scope='row'><span id='s'>Table Data</span></th>
            <td class='tdh'>Table Data</td> 
        </tr>
        <tr class="cat2">
            <th scope='row'><span id='s2'>Table Data</span></th>
            <td class='tdh'>Table Data</td> 
        </tr>
    </tbody>
</table>

and wanted to style the span element we could grab the element by where it lies with the table:

table tr.cat1 span {
  some css;
}

or by the id:

#s {
  some css;
}

Are there any big differences in the way these actually work? I have found working with the id much simpler with a smaller margin for error, though I have found many examples of people using the former. Is there a specific reason for this? Or is it really just down to personal preference?

  • 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-06-07T14:04:14+00:00Added an answer on June 7, 2026 at 2:04 pm

    IMO opinion you want to avoid styling by ID at all costs, but i also subscribe to the OOCSS method of doing things that Nicole Sullivan has championed. Basically what it comes down to is that styles targeted by ID are not reusable, which usually starts to get out of hand and results in the exact same style declaration in multiple places, in addition to hijacking the specificity chain when they need to be overridden for certain cases. This article and that wiki page describes it in a much better way than im willing to outline here.

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

Sidebar

Related Questions

I have been working on this for few hours and got stuck, so how
I have been working with Zend for a few months now and am at
I have been working with Zend Framework for a few months now. I have
I have been working on learning the Android NDK the past few days, but
So I have been working on this for a few days now, and I
I've been working on this problem for a few hours and have used many
I've been working with R just a few months, I have a problem with
I have been working with SQL Server as a Developer a while. One thing
I have been working with a few applications that deal with NSURLConnections. While researching
I have only been working with android app development for a few days so

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.