CSS Basics Flashcards

1
Q

Basic syntax

A

p {

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

comment syntax

A

/* comment here */

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Block style

A

surrounds portions of code in curly braces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Property

A

identifies which component to change

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Value

A

specifies the value of the attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Declaration

A

indicates a property/value pair

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Class selector

A
  • selects all elements with the specified class attribute

- use a period before class name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

ID selector

A
  • selects all elements with specified ID attribute

- use # pound symbol before class name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Universal selector

A
  • selects all elements on the page

- use * symbol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Parent-child selector

A
  • selects all immediate matching children of an element
  • use > symbol between parent and child

ex: div > p {
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Ancestor-descendant selector

A

-selects all matching descendants of an element (general descendants)
-use a space between two selectors
ex: div p {
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Sibling selector

A
  • to select elements that are siblings (immediate children of the same parent
  • use + sign
    ex: h2 + p {}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Predecessor/Successor selector

A
  • selects all successors of an element
  • its a generic sibling selector
  • use the tilde character (~)
    ex: p ~ span {}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Combining selectors

A
  • you can combine multiple selectors to apply styles to more specific elements
  • use period
    ex: p.red.tall {}
17
Q

Specifying color

A

Examples:

name(red)
hex-value (#FF0000)
rgb (255,0,0)
rgba (255,0,0,1)
hsl(360,100%,100%)
hsla(360,100%,100%,1)
18
Q

Specifying color (hexadecimal)

A
  • Each set of two characters identifies a value between 0 and 255 for its corresponding color component.
  • hex-value (#FF0000)
19
Q

Specifying color (rgb)

A
  • specify color in base 10 as a value between 0 and 255 for each component (red, green,blue)
  • p{
    color: rgb() }
20
Q

Specifying color (rgba)

A

-4th value between 0 and 1 indicate level of transparency

21
Q

Specifying color (hsl)

A

-specify a color in terms of hue, saturation (%) and lightness (%)

22
Q

Specifying color (hsla)

A

-alpha value as a -4th value between 0 and 1 indicate level of transparency

23
Q

Background property

A
  • use the background property to change styling for background of elements
  • can change color, size, position, image and repeat
  • use background prefix
    ex: background-color : #FF00FF;
24
Q

Background shorthand

A

-applies multiple properties in a single statement
-ex:
div {
background: url(“bg.jpg”) #0000ff top right;
}

25
Q

CSS color and background summary

A

CSS offers ways to manage the color and background properties of elements.

Color can be defined in multiple ways including a predefined name, hexadecimal, rgb or hsl values.
You can further control many aspects of background including size, image, position, repeat, and color.