Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Specificity Huh ?

Featured Replies

I don't worry about specificity much, it hardly ever happens and if it does I hunt for the problem.

 

HTMLDog says

It may not seem like something that important, and in most cases you won't come across any conflicts at all, but the larger and more complex your CSS files become, or the more CSS files you start to juggle with, the greater likelihood there is of conflicts turning up.

 

If the selectors are the same then the latest one will always take precedence.

 

Basically, it's the level of importance, not the order of importance, so

div p { color: red; }
p { color: blue; }

 

The color in a div p tag will be red even though the color blue is coded and processed last because the div p {} has a greater importance as it's more precisely defined.

Edited by Wickham

As a general rule, try to give your CSS only as much specificity as it asolutely needs. Inherit values where possible, and use the cascade to your advantage.

 

If you need to use !important to override something, it's a fairly good sign that your CSS sucks.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.