CSS Color & Background Color | CSS Course For Beginners To Advanced 2021.

Hello Dear Readers, Today In this Post, You will learn CSS Color & Background Color | CSS Course For Beginners To Advanced 2021. Earlier I have shared CSS Implementation | CSS Course For Beginners To Advanced 2021. and now it’s time to CSS Color & Background Color | CSS Course For Beginners To Advanced 2021.

 

Introduction

This module describes CSS properties which allow authors to specify the foreground color and opacity of the text content of an element. This module also describes in detail the CSS <color> value type.

 

It not only defines the color-related properties and values that already exist in CSS1CSS2, and CSS Color 3, but also defines new properties and values.

 

In particular, it allows specifying colors in other colorspaces than sRGB; previously, the more saturated colors outside the sRGB gamut could not be used in CSS even if the display device supported them. In addition to the family of RGB  colorspaces, colorspaces with other primaries such as CMYK or KCMYGOV are supported.

 

Color terminology

color is a definition (numeric or textual) of the human visual perception of a light or a physical object illuminated with light. The objective study of human color perception is termed colorimetry. If two objects have different spectra, but produce the same physical sensation, we say they have the same color.

 

Representing Colors: the <color> type

CSS has several syntaxes for specifying color values. Some directly specify an sRGB color by its channels, such as the hex color notation or rgb() function. Others are more human-friendly to write and understand, such as the hsl() and lch() functions, or the long list of named colors.

 

<color> = <hex-color> | <named-color> | currentcolor | transparent |
    <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hwb()> |
    <lab()> | <lch()> |
    <color()> | <device-cmyk()> |
    <system-color>

 

Play Video

Setting Backgrounds & Gradients

Backgrounds have a significant impact on the design of a website. They help create a site’s look and feel, establish groupings, and assign priority, and they have a considerable influence on a website’s usability.

 

Within CSS, element backgrounds can be a solid color, an image, a gradient, or a combination of these. As we decide how to implement these backgrounds, we should keep in mind that every background contributes to the overall appearance of our website.

 

In this lesson we’re going to take a look at how to assign different types of backgrounds, including gradients, to elements; we’ll also play around with a handful of CSS3 properties specific to backgrounds.

 

Adding a Background Color

The quickest way to add a background to an element is to add a single-color background using the background or background-color property. The background property accepts colors and images in shorthand form, while the background-color property is used strictly for setting solid background colors. Either property will work, and which one you decide to use depends on your preference as well as the case for which you’re using it.

 

div {

background-color: #b2b2b2;

}

 

When adding a background color, we have a few options for the values we can use. As with other color values, we can pick from keywords, hexadecimal codes, and RGB, RGBa, HSL, and HSLa values. Most commonly we’ll see hexadecimal values; however, we may occasionally want to use RGBa or HSLa values for transparencies.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Introducing Official ApeStaking Protocol for ApeCoin.

New Blur NFT Marketplace Courting Professional.