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.

Class in CSS

Featured Replies

Hi all!

 

Sometimes I see something like this:

<div class="colmask threecol">

 

What does this mean?

 

When we use that declaration?

 

Thanks in advanced.

class="colmask threecol"

 

is just applying two classes, colmask and threecol. You can have more than two. Styles for colmask will be overwritten if any similar styles are in threecol.

 

You can't have two or more in an id.

class="colmask threecol"

 

is just applying two classes, colmask and threecol. You can have more than two. Styles for colmask will be overwritten if any similar styles are in threecol.

 

You can't have two or more in an id.

 

That's only true if the threecol class is defined after colmask in the stylesheet.

Skateside it's always true. That sets two classes under an element. So you can easily target them for different purposes. If that's a div it will be at the same time div.colmask and div.threecol.

That's only true if the threecol class is defined after colmask in the stylesheet.

No, It's always true in the html markup whatever the order in the stylesheet. You could have .colmask after .threecol in the stylesheet and .threecol after colmask here in the markup and .threecol will take priority. You are thinking of two similar styles in the stylesheet for say .colmask covering the same style where the later one will take priority, so it's then important to consider the order in the stylesheet where the same style name is repeated.

Oh... talking about the css priorities. That goes with the logic: latter has priority (unless it's !important).

Edited by Sendoushi

No, It's always true in the html markup whatever the order in the stylesheet. You could have .colmask after .threecol in the stylesheet and .threecol after colmask here in the markup and .threecol will take priority. You are thinking of two similar styles in the stylesheet for say .colmask covering the same style where the later one will take priority, so it's then important to consider the order in the stylesheet where the same style name is repeated.

 

Sorry, but that's just not the case. The order of classes in the style sheet is the important aspect, the order in the markup doesn't matter like this

Well done! I make sure I never duplicate styles, so I never come across that situation. If I use two or three classes, it's for different reasons, say one for font, one for position, one for background, etc.

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.