Cascading Style Sheets Flashcards
What are the two aspects to adding style to a web page via CSS?
Declaration & Selector
Tells the browser to apply the declared style to the HTML <body> element.
Selector
The most basic kind of CSS selector. It selects every instance of the corresponding HTML element.
Simple type selectors
Selects all elements on a page and can be used in combination with other selectors.
Wildcard selector
You can apply the same declaration to a group of selectors by listing all of the desired selector names separated by commas.
Grouping selectors
What are the two naming options for an HTML element?
ID names & Class names
The syntax is similar of that to Grouping selectors, but without the commas.
Descendant (Nested) selectors
The associated style selectors.
Hyperlink (or “anchor) pseudo-class selectors
What is the correct order when styling hyperlinks?
a.link
a.visited
a.hover
a.active
Lo Ve H A
A more specific selector beats out a less specific selector.
Cascading
What if there is a “tie” regarding how specific the selectors are?
In a tie, the last-defined selector wins.
How/Where do we add the style declaration to our HTML files?
- Internal Stylesheet
- External Stylesheet
- Inline Style
Put the style declarations in the <head> of HTML text file. Also known as “Embedded” or “Global”.
Internal Stylesheet
Put the style declarations in a separate text file and then import that text file into your HTML file.
External Stylesheet
Simply put the style declaration within the HTML tag when it is used.
Inline Style
Refers to the layout of the items on your page. Also refers to the “position” descriptor in CSS rules.
Positioning