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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:36:07+00:00 2026-05-16T04:36:07+00:00

Sometimes !important is useful, for example if I have defined common style for all

  • 0

Sometimes !important is useful, for example if I have defined common style for all links on the site (selector, say, a), but when I want to override some rules I have the following choices:

  • Use more specific (longer) selector
  • Use !important

Which way is better and may be there are some guidelines?

  • 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-16T04:36:07+00:00Added an answer on May 16, 2026 at 4:36 am

    Use !important very, VERY sparingly — it overrides just about everything, even inline styles, and messes in a less-than-obvious way with the “cascade” of style rules that gives CSS its name. It’s easy to use badly, and tends to multiply, particularly when misused. You can easily end up with a element with !important rules that you want to override, at which point you often have to either refactor your styles, or use another !important rule and contribute to the problem.

    And once it’s spread and you’re using it everywhere, you’re back up in the same situation you’d be in without it (difficulty in specifying elements specifically enough to override other styles), but you also don’t have !important anymore cause everything else is using it too.

    When faced with a situation where !important looks appealing — or worse, one where it’s already in use and spreading — prefer to refactor your CSS if you can. (Frankly, if you need !important outside of a user style sheet, it’s usually because your selectors are already way too specific, and/or you’re not taking advantage of the C in CSS.) You’d do better to define your basic styles as close as possible to the html or body elements, and when you want to override, use as little specificity as you can get away with. That way, you have plenty of room to make changes. Usually there’s a reason you want to override a style, and those cases can quite often be boiled down to a class name, a particular section of the page (read: a particular parent element), etc.

    (The only real exception that springs to mind is if the styles you’re overriding are effectively out of your control. (If you use a framework that has very strong opinions on how your page should look, for example, you might find it annoyingly difficult to override anything. I’ve worked with applications that actually inserted their own inline styles, where nothing but an !important rule could override them.) If you don’t have full access to the code, overriding and refactoring can easily be more trouble than they’re worth. You can use !important to claw back some control, as long as you’re aware of the consequences.)

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

Sidebar

Ask A Question

Stats

  • Questions 494k
  • Answers 494k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Do not drop the column, it will clear the data.… May 16, 2026 at 10:55 am
  • Editorial Team
    Editorial Team added an answer A few differences that i found... Dalvik Vs JVM Architecture… May 16, 2026 at 10:55 am
  • Editorial Team
    Editorial Team added an answer If you add controls programmatically in code, every post-back operation… May 16, 2026 at 10:55 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

i have a php script which sometimes makes some light errors that are not
Sometimes with a complex header structure it happens some header is included, but it
I hear/read about it sometimes when talking about .NET, for example managed code and
I have made the question community wiki - it is subjective. I have upgraded
Here is the setup: end_date = DateTime.parse('2010-01-01 12:00:00-04') and sometimes it's initialized: end_date =
Sometimes, I find myself in a situation where valid files are made invalid by
Sometimes it can be confusing reading code in instance members that refers to other
Sometimes, when I upload files to ftp, and then download them, I face with
Sometimes, I felt method overloading may create confusion. class a { public: void copy(float
Sometimes, when fetching data from the database either through the python shell or through

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.