How to make div border gradient in css3

WBOY
Release: 2021-11-18 17:50:55
Original
4280 people have browsed it

In CSS, you can use the "border-image" attribute and linear-gradient() function to achieve the div border gradient effect. You only need to add "border-image:linear-gradient(upper color, lower color) to the div element. Color);" style is enough.

How to make div border gradient in css3

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

css3 method to make div border gradient

In css we can set the border style of the element through the border-images attribute, combined with linear -gradient function,

linear-gradient() function is used to create a picture that represents a linear gradient of two or more colors.

To create a linear gradient, you need to specify two colors. You can also achieve gradient effects in different directions (specified as an angle). If the direction is not specified, the gradient will default from top to bottom.

Just add the border-image: linear-gradient(red,blue); style to the div element.

The code example is as follows:

      Document 
Copy after login

Output result:

How to make div border gradient in css3

##For more programming related knowledge, please visit:

Programming video! !

The above is the detailed content of How to make div border gradient in css3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!