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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:47:56+00:00 2026-05-20T09:47:56+00:00

I am writing a bunch of PHP classes which will be used to create

  • 0

I am writing a bunch of PHP classes which will be used to create a WordPress plugin, but can also be used in any other environment. After testing my script by itself, all seems well, but when I created a WP plugin for it, there were CSS conflicts that I had foreseen. I initially planned on using specificity to solve these, but it can’t always be done. This is in the default WP theme:

#content tr td {
    border-top: 1px solid #E7E7E7;
    padding: 6px 24px;
}

If I try to specify a td to have no padding, it won’t work unless I add an ID to my table, rather than a class. I have seen popular plugins that implemented the !important rule on every single CSS property rather than using an ID for specificity. Which is best? I know the !important rule should be used sparingly, but adding an ID to my table seems to go against semantics, since there will be multiple instances of this table with the same ID:

The ID attribute of a document
language allows authors to assign an
identifier to one element instance in
the document tree.

http://www.w3.org/TR/CSS2/selector.html#id-selectors

EDIT:
An alternative may also be to wrap everything in a div with an ID, but if there exists a rule #content #main td or similar, it will still dominate over my #someid td. Also, as discussed below, it is not valid to have two elements sharing the same ID, although it may “work”.

  • 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-20T09:47:57+00:00Added an answer on May 20, 2026 at 9:47 am

    As I’ve said in the comments, you can include the #content rule in your selector together with a class to override the original styles if #content is the wrapper element (and it should be, since if is added to all table elements than there won’t be any way of adding more than one table to WordPress posts, which would be… weird).

    Anyway, if you have to choose between adding ids to multiple elements, and using !important on your properties, I would use !important for the simple reason that while !important may make your stylesheets unmaintainable, adding multiple ids may also break any JavaScript used on the page, and there’s no guarantee that the id selector implementation in all browsers can accommodate multiple elements with the same id, so the consequences are more severe.

    Basically, choosing between one highly-unrecommanded-but-otherwise-valid practise and invalid, undefined behavior.

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

Sidebar

Related Questions

No related questions found

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.