Selector Specificity
Which of the following CSS selectors has the highest specificity?
- element type
- #myId
- .myClass
- element[attribute]
- * universal
Overriding Styles
Given conflicting CSS rules, which factor determines the style that is ultimately applied to an element?
- The order in which the rules appear in the CSS file
- The number of characters in the selector
- The specificity of the selector
- The time the style was added
- The importance of the css
Attribute Selectors
Which CSS selector targets an element with a specific attribute, regardless of its value?
- element.attribute
- element#attribute
- element[attribute]
- element attribute
- element(attribute)
Type Selectors
What type of selector is 'h1' in the CSS rule 'h1 { color: blue; }'?
- Class selector
- ID selector
- Attribute selector
- Universal selector
- Type selector
Class Selector
Which symbol is used to denote a class selector in CSS?
- #
- .
- $
- %
- u0026
ID Selector
Which of the following correctly targets an element with the ID 'main-title'?
- .main-title
- id=main-title
- element[main-title]
- MainTitle
- #main-title
Universal Selector
Which selector matches all elements on a page?
- all
- element
- *
- global
- any
CSS Specificity Calculation
In CSS specificity, which of the following selectors will override the other?
- div {color:red;}
- body div {color: blue;}
- .container {color:green;}
- #container {color:yellow;}
- div#container {color: purple;}
Complex Selectors
Which of the following selectors targets all paragraph elements that are direct children of a div with the class 'content'?
- .content p
- div.content u003E p
- .content u003E p
- div .content p
- div + .content u003E p
The Importance of !important
What does the `!important` declaration do in a CSS rule?
- It encrypts the style.
- It makes the style apply only in Internet Explorer.
- It gives the style rule the highest priority, overriding all other conflicting styles.
- It makes the style rule apply only when printing.
- It makes the style optional