transparency in css code example
Example 1: css opacity example
.opacity30 {
opacity: 0.3;
filter: alpha(opacity=30); /* For IE8 and earlier */
}
Example 2: background image opacity css
/* Two ways to make images opaque */
div {
background-color : rgba(120, 120, 120, 0.5)
/* the 0.5 is the value of opacity on a scale of 0-1 */
}
/* OR */
div {
background-color : blue
opacity : 50%
}
Example 3: change transparancy img css
img {
opacity: 0.5;
}
Example 4: css opacity
.div{
opacity: 0.8; /* 1 means fully visible, 0 means invisible */
}
Example 5: opacity css
div {
background-color: yellow;
}
.light {
opacity: 0.2; /* Der Text kann kaum über dem Hintergrund gelesen werden */
}
.medium {
opacity: 0.5; /* Der Text ist besser über dem Hintergrund lesbar */
}
.heavy {
opacity: 0.9; /* Der Text ist sehr deutlich über dem Hintergrund lesbar */
}
Example 6: transparent background css
div {
width: 200px;
height: 200px;
display: block;
position: relative;
}
div::after {
content: "";
background: url(image.jpg);
opacity: 0.5;
top: 0;
left: 0;
bottom: 0;
right: 0;
position: absolute;
z-index: -1;
}