Reputation: 1171
I have this CSS:
#name {
border: 1px solid #fff;
color: #a5a5a5;
opacity: 0.3;
font-size: 11px;
font-family: "times new roman";
}
however the border also has opacity set as 0.3 but I do not want the border to have opacity how do I exclude this element?
Upvotes: 3
Views: 3865
Reputation: 1336
Try this
#name {
border: 1px solid #fff;
color: #a5a5a5;
opacity: 0.3;
font-size: 11px;
font-family: "times new roman";
height: 50px;
}
#name:after {
height: 50px;
border: 1px solid rgba(255, 255, 255, 1);
content: '';
display: block;
}
Upvotes: 0
Reputation: 20235
You can create a container.
#name {
border: 1px solid #fff;
color: #a5a5a5;
font-size: 11px;
font-family: times new roman;
}
.op3 {
opacity: 0.3;
}
<div id="name">
<div class="op3">
<!-- content -->
</div>
</div>
Upvotes: 0
Reputation: 1348
Change the HTML structure to:
<div id="name">
<div>
Stuff
</div>
<div>
And the CSS to:
#name {
border: 1px solid #fff;
}
#name div {
color: #a5a5a5;
opacity: 0.3;
font-size: 11px;
font-family: "times new roman";
}
Upvotes: 1
Reputation: 1407
you can add a container with border and the content with opacity:
<div id="container" style="border:1px solid #fff">
<div id="name">
--------
</div>
</div>
Upvotes: 1
Reputation: 224921
You can't. opacity
sets the opacity on the entire element. Depending on the element's actual content, you have two options:
<div>
and apply the border to that instead.rgba
to specify the text color and/or background color/gradient instead of opacity
.Upvotes: 6