background:#000; and background:rgba(255,255,255,0.8);: Both are background background attributes, but the values are expressed in different ways. #000 and rgba(255,255,255,0.8) are two different attribute values. The former is a hexadecimal value and the latter is an rgba value. a=alpha is used to represent opacity. 0.8 is written as .8 which is more professional. rgba is a new method added to CSS3, so pay attention to compatibility. Other commonly used color value methods include rgb. For more details, you can see the color value on the w3c official website. I am too lazy to post the link.
filter:alpha(opacity=80); and opacity:0.8;: Both can be used to set opacity. The former is a private attribute filter of IE. Because IE is not compatible with the latter writing method, the filter method is used to disguise it. To achieve the purpose of setting opacity.
More precisely, background-color:#FFF; is better than background: #FFFThis abbreviation of background is more suitable for background :url(path) center center no-repeat This kind of.
background:#000
Set background:opacity:0.5;
Set transparency, but it will affect child nodes:filter:alpha(opacity=80);
Mainly used for image processing and filters.css3filter
background:rgba(0,0,0,0.5);
Set background transparency, which will not affect child nodesAdd to the accepted answer above:
background:#000;
andbackground:rgba(255,255,255,0.8);
: Both arebackground
background attributes, but the values are expressed in different ways.#000
andrgba(255,255,255,0.8)
are two different attribute values. The former is a hexadecimal value and the latter is an rgba value. a=alpha is used to represent opacity.0.8
is written as.8
which is more professional. rgba is a new method added to CSS3, so pay attention to compatibility. Other commonly used color value methods include rgb. For more details, you can see the color value on the w3c official website. I am too lazy to post the link.filter:alpha(opacity=80);
andopacity:0.8;
: Both can be used to set opacity. The former is a private attribute filter of IE. Because IE is not compatible with the latter writing method, the filter method is used to disguise it. To achieve the purpose of setting opacity.background:rgba(0,0,0,0.5); sets background transparency and will not affect child nodes
More precisely, background-color:#FFF; is better than background: #FFFThis abbreviation of background is more suitable for background :url(path) center center no-repeat This kind of.