December 21, 201213 yr Hi all! Sometimes I see something like this: <div class="colmask threecol"> What does this mean? When we use that declaration? Thanks in advanced.
December 21, 201213 yr 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.
December 25, 201213 yr 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.
December 27, 201213 yr 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.
December 27, 201213 yr 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.
December 27, 201213 yr Oh... talking about the css priorities. That goes with the logic: latter has priority (unless it's !important). Edited December 27, 201213 yr by Sendoushi
December 28, 201213 yr this div is using 2 classes ... "colmask" and "threecol"... you can give multiple classes to any element just seperate by space.
December 28, 201213 yr 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
December 28, 201213 yr 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