Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use css3 to realize Linear gradient

Shulou Source: shulou.com Published: 2022-06-01 11:14:12 11月12日 Update

This article mainly introduces how to use css3 to achieve linear gradient, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

A brief introduction to the implementation of Linear gradient using css3

Two types of gradients are defined in css3: linear gradient and radial gradient. Linear gradient refers to the animation effect that shows a smooth transition between two or more colors. We usually use the new gradients attribute in css3 to achieve this effect. According to the direction of the gradient, we are divided into top-to-bottom, right-to-left and diagonal gradients, in which the default direction is from top to bottom.

The principle of using css3 to realize Linear gradient

We need to define two color nodes in css3, and these two colors are the colors that need a smooth transition, one of which is the starting point and the other is the end point. We take the div background as an example to describe the use of background:linear-gradient (direction,colro1,color2); syntax.

Use css3 to achieve linear gradient code

Type 1: the gradient direction is from top to bottom.

Gradients attribut

Div {

Width:400px

Height:200px

Background:-webkit-linear-gradient (red,blue)

Background:-o-linear-gradient (red,blue)

Background:-moz-linear-gradient (red,blue)

Background:-mos-linear-gradient (red,blue)

Background:linear-gradient (red,blue)

}

Thank you for reading this article carefully. I hope the article "how to use css3 to achieve linear gradient" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Linear color two article direction node smooth that is attribute effect type between code value interest animation principle at the same time diagonal radial Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Technology Shulou Information NVidia Microsoft