Know Your CSS

Oct 30, 2013 • Bill Mills

Here are a couple of questions to distinguish knowledge levels in CSS.

Beginner v. Competent

A CSS rule without any precedence-modifying keywords located in which of these places has the highest precedence in setting a CSS property?

(a) In the CSS rule in the author stylesheet applying to the element’s class

(b) In the element’s inline style

(c) In the browser default for the page

(d) In In the CSS rule in the author stylesheet applying to the element’s ID

 

Competent v. Expert

Here are some CSS rules and a DOM element containing some text.  What color will the text render?  No loading it in a browser until you’re done!

CSS rules:

div#myDiv{
color:#FF0000;
}

div.awesomeDivs{
color:#00FF00 !important;
}

div {
color:#0000FF;
}

DOM element:

What Color Is This Text?

(a) #FF0000

(b) #00FF00

(c) #0000FF

(d) #FF00FF