CSS Basics Flashcards
1
Q
Basic syntax
A
p {
2
Q
comment syntax
A
/* comment here */
3
Q
Block style
A
surrounds portions of code in curly braces
4
Q
Selector
A
- CSS offers several ways to identify which elements to apply a style to using a selector
- identifies what element to style
5
Q
Property
A
identifies which component to change
6
Q
Value
A
specifies the value of the attribute
7
Q
Declaration
A
indicates a property/value pair
8
Q
Class selector
A
- selects all elements with the specified class attribute
- use a period before class name
9
Q
ID selector
A
- selects all elements with specified ID attribute
- use # pound symbol before class name
10
Q
Universal selector
A
- selects all elements on the page
- use * symbol
11
Q
Selecting multiple elements
A
- selects multiple elements using different selectors
- use common (,) to delimit multiple selectors
ex: html, body, h1, p { //apply CSS here }
12
Q
Parent-child selector
A
- selects all immediate matching children of an element
- use > symbol between parent and child
ex: div > p {
}
13
Q
Ancestor-descendant selector
A
-selects all matching descendants of an element (general descendants)
-use a space between two selectors
ex: div p {
}
14
Q
Sibling selector
A
- to select elements that are siblings (immediate children of the same parent
- use + sign
ex: h2 + p {}
15
Q
Predecessor/Successor selector
A
- selects all successors of an element
- its a generic sibling selector
- use the tilde character (~)
ex: p ~ span {}