Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opacity feature for css - transparency inside div

Tags:

html

css

I am confused abut the working of html opacity feature... Assume there are two divs, one inside the other, and I apply opacity to the outer div, it will automatically apply opacity to inner div too. how can we undo that, like opacity should work only for outer div?

Ive used the css code opacity http://jsfiddle.net/4uMdj/

like image 227
Da Silva Avatar asked Mar 27 '26 23:03

Da Silva


2 Answers

If your are using background-color in your outer DIV then you can define rgba value to it. Write like this:

.outer{
 background-color: rgba(0,0,0,0.5);
}

& for IE use IE filter

you can generate your rgba filter for IE from here http://kimili.com/journal/rgba-hsla-css-generator-for-internet-explorer/

like image 79
sandeep Avatar answered Mar 29 '26 14:03

sandeep


.parent{
    position: relative;
}

.parent:before {
    z-index: -1;
    content: '';
    position: absolute;

    opacity: 0.3;
    width: xxpx;
    height: xxpx;
    background: ; 
}

.child{
    Color:xx;
}
like image 45
Prashobh Avatar answered Mar 29 '26 14:03

Prashobh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!