Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use css to realize multiple color gradients

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article "how to use css to achieve multiple color gradients" article, the article sample code is very detailed, with a certain reference value, interested friends must refer to, for "how to use css to achieve multiple color gradients", Xiaobian sorted out the following knowledge points, please follow the pace of Xiaobian step by step slowly understand, then let us enter the topic.

I created common buttons in HTML and provided them with common and specific class names as well as styles to decorate the buttons.

HTML

Button1

Button2

Button3

Button4

Button5

CSS

.button {

Float:left

Height:40px

Line-height:40px

Margin-right:20px

Padding:015px

Color:#fff

Font-weight:bold

Font-size:16px

Font-family:arial

Background-color:#555

Border-radius:5px;border:solid1pxrgba (0. 0. 5)

}

Give each button a unique color (regular background color).

CSS

.button1 {background-color:orange;}

.button2 {background-color:red;}

.button3 {background-color:green;}

.button4 {background-color:RoyalBlue;}

.button5 {background-color:OrangeRed;}

Now, it's easy to make all these gradients. Instead of using full-color gradients, such as red and crimson, I use a gradient with a black background color with an opacity of 0% until the black background color has an opacity of 65%.

Then add this gradient to the transparency of the common button class.

CSS

.button {

Background-image:linear-gradient (rgba (0re0penol 0) 0) 0% recorder rgba (0pc0penol 0.65) 100%)

}

Well, now we've finished using only one gradient in CSS to make multiple gradients.

Complete code:

.button {

Float:left

Height:40px

Line-height:40px

Margin-right:20px

Padding:015px

Color:#fff

Font-weight:bold

Font-size:16px

Font-family:arial

Background-color:#555

Border-radius:5px

Border:solid1pxrgba (0. 0. 5)

Background-image:linear-gradient (rgba 0) 0) 0% W3C*/)

}

.button1 {background-color:orange;}

.button2 {background-color:red;}

.button3 {background-color:green;}

.button4 {background-color:RoyalBlue;}

.button5 {background-color:OrangeRed;}

Button1

Button2

Button3

Button4

Button5

What is the full name of css? the full name of css is Cascading Style Sheets (cascading style sheets), a computer language used to express file styles such as HTML or XML. CSS can not only modify the web page statically, but also format the elements of the web page dynamically with various scripting languages.

The above is all the content of the article "how to use css to achieve multiple color gradients". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report