Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Customize Background Behavior | Сolors and Background
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to CSS Part II

bookCustomize Background Behavior

Now that we have gone over the background basics, some properties related to the background can be customized as required. Here is a detailed explanation of each property that can be set using the background shorthand property:

background-repeat

Specifies whether the background image should be repeated horizontally, vertically, or not at all. Valid values are repeat, repeat-x, repeat-y, and no-repeat. For example:

body {
  background-repeat: no-repeat;
}

This prevents the background image from being repeated on the body element.

background-attachment

Specifies whether the background image should scroll with the rest of the page or stay fixed in place. Valid values are scroll and fixed. For example:

body {
  background-attachment: fixed;
}

This sets the background image to stay fixed in place on the body element, even if the page is scrolled.

background-position

Specifies the position of the background image. This can be a keyword (such as center, top, or bottom), a length value, or a combination of the two. For example:

body {
  background-position: center;
}

This centers the background image on the body element.

background-clip

Specifies whether the background image should be painted within the border box, padding box, or content box of an element. Valid values are border-box, padding-box, and content-box. For example:

body {
  background-clip: content-box;
}

This sets the background image to be painted within the content box of the body element.

background-origin

Specifies the position of the background image within the element's background positioning area. Valid values are border-box, padding-box, and content-box. For example:

body {
  background-origin: content-box;
}

This sets the background image to be positioned within the content box of the body element.

background-size

Specifies the size of the background image. This can be a keyword (such as cover or contain), a length value, or a combination of the two. For example:

body {
  background-size: cover;
}

This sets the background image to cover the entire body element.

1. Which of the following CSS color formats allows you to specify a color using hue, saturation, and lightness values?

2. Which of the following values can be used with the background-origin property to specify that the background image should be positioned relative to the border box of the element?

3. Which of the following is a valid CSS color format?

4. Fill in the blanks to specify a fixed, no-repeat background image that scales to cover the entire element

question mark

Which of the following CSS color formats allows you to specify a color using hue, saturation, and lightness values?

Select the correct answer

question mark

Which of the following values can be used with the background-origin property to specify that the background image should be positioned relative to the border box of the element?

Select the correct answer

question mark

Which of the following is a valid CSS color format?

Select the correct answer

question-icon

Fill in the blanks to specify a fixed, no-repeat background image that scales to cover the entire element

body {
background-image: url(image.jpg);
background-attachment: ;
background-repeat:
;
background-size:
;
}

Clique ou arraste solte itens e preencha os espaços

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 5

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

bookCustomize Background Behavior

Deslize para mostrar o menu

Now that we have gone over the background basics, some properties related to the background can be customized as required. Here is a detailed explanation of each property that can be set using the background shorthand property:

background-repeat

Specifies whether the background image should be repeated horizontally, vertically, or not at all. Valid values are repeat, repeat-x, repeat-y, and no-repeat. For example:

body {
  background-repeat: no-repeat;
}

This prevents the background image from being repeated on the body element.

background-attachment

Specifies whether the background image should scroll with the rest of the page or stay fixed in place. Valid values are scroll and fixed. For example:

body {
  background-attachment: fixed;
}

This sets the background image to stay fixed in place on the body element, even if the page is scrolled.

background-position

Specifies the position of the background image. This can be a keyword (such as center, top, or bottom), a length value, or a combination of the two. For example:

body {
  background-position: center;
}

This centers the background image on the body element.

background-clip

Specifies whether the background image should be painted within the border box, padding box, or content box of an element. Valid values are border-box, padding-box, and content-box. For example:

body {
  background-clip: content-box;
}

This sets the background image to be painted within the content box of the body element.

background-origin

Specifies the position of the background image within the element's background positioning area. Valid values are border-box, padding-box, and content-box. For example:

body {
  background-origin: content-box;
}

This sets the background image to be positioned within the content box of the body element.

background-size

Specifies the size of the background image. This can be a keyword (such as cover or contain), a length value, or a combination of the two. For example:

body {
  background-size: cover;
}

This sets the background image to cover the entire body element.

1. Which of the following CSS color formats allows you to specify a color using hue, saturation, and lightness values?

2. Which of the following values can be used with the background-origin property to specify that the background image should be positioned relative to the border box of the element?

3. Which of the following is a valid CSS color format?

4. Fill in the blanks to specify a fixed, no-repeat background image that scales to cover the entire element

question mark

Which of the following CSS color formats allows you to specify a color using hue, saturation, and lightness values?

Select the correct answer

question mark

Which of the following values can be used with the background-origin property to specify that the background image should be positioned relative to the border box of the element?

Select the correct answer

question mark

Which of the following is a valid CSS color format?

Select the correct answer

question-icon

Fill in the blanks to specify a fixed, no-repeat background image that scales to cover the entire element

body {
background-image: url(image.jpg);
background-attachment: ;
background-repeat:
;
background-size:
;
}

Clique ou arraste solte itens e preencha os espaços

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 5
some-alt