CSS Flashcards
CSS
What are the three parts of a CSS rule?
Selector, Declaration Block, Declaration
What is a CSS Declaration?
A CSS property followed by a colon (:) and the property value.
What is a CSS Selector?
The HTML elements to which the specific style rule applies.
What is a CSS Declaration Block?
One or more declarations separated by semicolons (;).
Is it a good practice to place each declaration on a separate line and to add a semicolon to the end of each declaration block?
True
What are the valid ways CSS can be implemented?
Embedded, External, Inline
Does an inline style use a selector?
False
Does an inline style use curly braces {}?
False
Should a website use an external stylesheet for styles that apply to all web pages?
True
Can inline styles be used with embedded and external stylesheets?
True
Do CSS style declarations override the default browser style declarations?
True
What is CSS inheritance?
When style declarations from a parent element cascade down and are applied to any child elements.
Can the !important rule be used to override other declarations and disregard specificity?
True
What are the valid CSS selector types?
Class, Descendant, Element, ID, Pseudo-Class
Are class names in HTML separated by commas?
False, they are separated by spaces.
What are some valid pseudo-class selectors?
:empty, :enabled, :hover, :lang(language)
Do pseudo-class selectors match elements based on user behavior or meta-information about HTML elements?
True
What are the different types of CSS selectors and their functions?
Element Selector: Selects HTML elements by name.
Class Selector: Uses . to select elements with a class.
Descendant Selector: Selects elements inside another element.
ID Selector: Uses # to select elements by ID.
Pseudo-Class Selector: Uses : to apply styles based on a state.
What is the universal selector in CSS?
*
What is the term for combining multiple selectors?
Multiple Selector
What is the child selector symbol in CSS?
>
What is the general sibling selector symbol in CSS?
~
What is the adjacent sibling selector symbol in CSS?
+
What are the different CSS combinators?
Adjacent Sibling, Child, Descendant, General Sibling
How is an attribute selector specified?
With an attribute name and optional value comparison enclosed in square brackets ([ ]).
Does the pseudo-element selector (::) match parts of elements?
True
What does the CSS color property control?
Text color
What are valid ways to specify color in CSS?
Hexadecimal Color, HSL Color Value, RGB Color Value, RGBA Color Value
What are the valid values for the float property?
Left, None, Right
Do float and clear properties control how text flows around elements, similar to magazine layouts?
True
Does the inline-block property display content as a block element but format it as an inline element?
True
Are CSS variables defined with //?
False, they are defined with –.
Where are CSS variables declared for global scope?
:root
What is the syntax to declare a CSS variable?
–section-color: black;
How do you use a CSS variable?
color: var(–section-color);
What are the absolute length units in CSS?
cm, in, mm, pc, pt, px
What are the components of the CSS box model?
Border, Content, Margin, Padding
What is the abbreviation for pixels in CSS?
px