View Full Version : Resolved Opacity prob`
Burgin
04-05-2012, 06:27 PM
I've set a wrapper DIV to 0.4 opacity, how do I prevent the opacity of any content?
Thanks in advance
coothead
04-05-2012, 10:31 PM
Hi there Burgin,
try it with "rgba()"...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<style type="text/css">
#box {
width:324px;
line-height:200px;
border:1px solid #000;
margin:24px auto 0;
font-family:verdana,sans-serif;
font-size:28px;
font-weight:bold;
text-align:center;
color:rgb(255,0,0);
background-color:rgba(255,0,0,0.4);
}
</style>
</head>
<body>
<div id="box">opacity test</div>
</body>
</html>
coothead
to clarify,
opacity applies to an element and all of its content (all child elements and text). it's supposed to work this way; you can't "prevent" it.
if you only want the background to be semi-transparent, use an rgba value for the element's background, as coothead suggests.
Burgin
04-09-2012, 09:50 AM
@traq @coothead... Thanks, that's beautiful.
coothead
04-09-2012, 10:08 AM
No problem, you're very welcome. ;)
coothead
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.