Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Background Color | Decorative Effects
CSS Fundamentals
course content

Conteúdo do Curso

CSS Fundamentals

CSS Fundamentals

1. Introduction to CSS
2. Text Styles
3. Box Model and Element Spacing
4. Flexbox
5. Decorative Effects

Background Color

The background color of a website plays a crucial role in setting the tone and atmosphere of the site. It's one of the primary visual elements that users will see when they visit your site, and it can greatly impact the overall look and feel of the website.

background-color property

We can set background color for an element with help of this porperty. The value can be in any format: hex, rgb, rgba or reserved word.

html

index

css

index

js

index

copy

static vs gradient color

Static color refers to a single color value that is applied uniformly to an element, such as red or #0000FF . On the other hand, gradient color involves blending two or more colors together to create a smooth transition between them.

html

index

css

index

js

index

copy

With gradient color, we can create more visually attractive and dynamic designs than with static color. Let's consider different ways to declare gradients.

linear gradient

To set the linear gradient background color we use:

html

index

css

index

js

index

copy

Also, we can specify the color percentage in the gradient color.

html

index

css

index

js

index

copy

solid linear gradient

We get striped background color if we specify the same percentage for adjacent colors. Let's run the example to get what the difference is.

html

index

css

index

js

index

copy

radial gradient

Radial gradient works the same way as linear. The only difference is that color starts at the center and spreads outwards.

html

index

css

index

js

index

copy
1. What is the main difference between static color and gradient color in CSS?
2. What is the difference between linear gradient and radial gradient in CSS?

What is the main difference between static color and gradient color in CSS?

Selecione a resposta correta

What is the difference between linear gradient and radial gradient in CSS?

Selecione a resposta correta

Tudo estava claro?

Seção 5. Capítulo 1
We're sorry to hear that something went wrong. What happened?
some-alt