Prelims - CSS backgrounds Flashcards

1
Q

properties are used to add background effects for elements

A

CSS Backgrounds

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

property specifies the background color of an element

A

background-color

body {
  background-color: lightblue;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

specifies the opacity/transparency of an element. It can take a value from 0.0 - 1.0. The lower value, the more transparent

A

opacity

div {
  background-color: green;
  opacity: 0.3;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

property specifies an image to use as the background of an element

A

background-image

body {
  background-image: url("paper.gif");
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

By default, the ____ property repeats an image both horizontally and vertically

A

background-image

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

To repeat an image vertically, set

A

background-repeat: repeat-y;

body {
  background-image: url("gradient_bg.png");
  background-repeat: repeat-y;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

To repeat an image horizontally, set

A

background-repeat: repeat-x;

body {
  background-image: url("gradient_bg.png");
  background-repeat: repeat-x;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Show the background image only once

A

background-repeat: no-repeat;

body {
  background-image: url("img_tree.png");
  background-repeat: no-repeat;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

property is used to specify the position of the background image

A

background-position

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

property specifies whether the background image should scroll or be fixed (will not scroll with the rest of the page

A

background-attachment

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

Specify that the background image should be fixed

A

background-attachment: fixed

body {
  background-image: url("img_tree.png");
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: fixed;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Specify that the background image should scroll with the rest of the page

A

background-attachment: scroll

body {
  background-image: url("img_tree.png");
  background-repeat: no-repeat;
  background-position: right top;
  background-attachment: scroll;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

To shorten the code, it is also possible to specify all the background properties in one single property. This is called a

A

CSS background - Shorthand property

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

Instead of writing:

body {
  background-color: #ffffff;
  background-image: url("img_tree.png");
  background-repeat: no-repeat;
  background-position: right top;
}
A

Use the shorthand property to set the background properties in one declaration

body {
  background: #ffffff url("img_tree.png") no-repeat right top;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

CSS backgrounds

When using the shorthand property the order of the property values is

A
  1. background-color
  2. background-image
  3. background-repeat
  4. background-attachment
  5. background-position
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Specifies the size of the background image(s)

A

background-size

17
Q

Specifies the painting area of the background

A

background-clip