问题
I want to make the list menu disappear by using opacity without affecting font. Is it possible with CSS3?
回答1:
now you can use rgba in CSS properties like this:
.class{
background: rgba(0,0,0,0.5);
}
0.5 is the transparency, change the values according to your design.
Live demo http://jsfiddle.net/EeAaB/
more info http://css-tricks.com/rgba-browser-support/
回答2:
Keep these three options in mind (you want #3):
1) Whole element is transparent:
visibility: hidden;
2) Whole element is somewhat transparent:
opacity: 0.0 - 1.0;
3) Just the background of the element is transparent:
background-color: transparent;
回答3:
yes, thats possible. just use the rgba-syntax for your background-color.
.menue{
background-color: rgba(255, 0, 0, 0.5); //semi-transparent red
}
回答4:
In this case background-color:rgba(0,0,0,0.5);
is the best way.
For example: background-color:rgba(0,0,0,opacity option);
回答5:
Here is an example class using CSS named colors:
.semi-transparent {
background: yellow;
opacity: 0.25;
}
This adds a background that is 25% opaque (colored) and 75% transparent.
CAVEAT
Unfortunately, opacity will affect then entire element it's attached to.
So if you have text in that element, it will set the text to 25% opacity too. :-(
The way to get past this is to use the rgba
or hsla
methods to indicate transparency as part of your desired background "color". This allows you to specify the background transparency, independent from the transparency of the other items in your element.
Here are 3 ways to set a blue background at 75% transparency, without affecting other elements:
background: rgba(0%, 0%, 100%, 0.75)
background: rgba(0, 0, 255, 0.75)
background: hsla(240, 100%, 50%, 0.75)
回答6:
Try this:
opacity:0;
For IE8 and earlier
filter:Alpha(opacity=0);
Opacity Demo from W3Schools
回答7:
To achive it, you have to modify the background-color
of the element.
Ways to create a (semi-) transparent color:
The CSS color name transparent
creates completely transparent color.
Usage:
.transparent{
background-color: transparent;
}
Using rgba
or hsla
color functions, that allows you to add the alpha channel (opacity) to the rgb
and hsl
functions. Their alpha values range from 0-1.
Usage:
.semi-transparent-yellow{
background-color: rgba(255,255,0,0.5);
}
.transparent{
background-color: hsla(0,0%,0%,0);
}
Besides the already mentioned solutions, you can also use the HEX format with alpha value (#RRGGBBAA
notation).
That's pretty new (contained by CSS Color Module Level 4), but already implemented in larger browsers (sorry, no IE).
This differs from the other solutions, as this treat the alpha channel (opacity) as hexadecimal as well, making it range from 0 - 255 (FF
).
Usage:
.semi-transparent-yellow{
background-color: #FFFF0080;
}
.transparent{
background-color: #00000000;
}
回答8:
Yes you can just plain text as
.someDive{
background:transparent
}
来源:https://stackoverflow.com/questions/11184117/transparent-css-background-color