HTML and CSS Reference
Correct answer: C
Incorrect: .required is a class selector.
Incorrect: #required is an ID selector.
Correct: input[required] is an attribute selector.
Incorrect: :required is a pseudo-class that would be combined with an element
Correct answer: D
Incorrect: a:link would specify the styles for an unvisited hyperlink.
Incorrect: a:mouseover is not a valid pseudo-class.
Incorrect: a:beforeclick is not a valid pseudo-class.
Correct: a:hover will change the style when the user moves the mouse over the
Objective 4.6: Thought experiment
When you want to achieve specific formatting on complex webpages, you need to account
for the hierarchy of your page and ensure that you understand how the inheritance is going
to impact the nested HTML elements' styles. The more specific your selectors, the more CSS
you need to write but have more control. The following code will demonstrate a specific se-
lector that will alter only the first character of the first paragraph when a user hovers over it:
This code does not seem like much, but it is very specific. It will override default inheri-
tance and any other styles defined for that same element. Consider the following CSS:
The first selector will default the size of the first letter to xx-small but the hover class will
override this. This is where it may be desirable to use the !important keyword to force the xx-
small font. In this example, the two styles purely conflict. You would need to choose one over