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 set the background color transparent by css

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the knowledge of "how to set background color transparency in css". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

There are two ways to set background color transparency in css: one is through rgba, and the other is through backgroud and opacity.

Setting background color transparency through backgroud and opacity

The attribute value in the background attribute is relatively simple, so we won't go into details here. You can refer to the css learning manual to learn about it. Let's take a brief look at the opacity attribute here.

The "opacity" of the opacity attribute parameter is expressed as a number, from 0.0 to 1.0, with full transparency of 0.0 and full opacity of 1.0. In other words, a higher number means that the element is more opaque. In addition to opacity, inherit inherits parent properties, but browser support is poor and is not recommended.

The code is as follows:

.box {

Width:300px

Height:200px

Margin:0auto

Border:1pxsolid#ccc

Background:red

Opacity:0.2

}

This is the end of the content of "how to set background color transparency in css". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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