I know this is old, but just in case it will help someone else.
<div style="background-color: rgba(255, 0, 0, 0.5)">child</div>
Where rgba
is: red, green, blue, and a
is for transparency.
More Related Contents:
- Set opacity of background image without affecting child elements
- Using CSS for a fade-in effect on page load
- CSS opacity only to background color, not the text on it? [duplicate]
- Opacity CSS not working in IE8
- Opacity of background-color, but not the text [duplicate]
- Is there any way to hover over one element and affect a different element? [duplicate]
- What has bigger priority: opacity or z-index in browsers?
- Style element based on selected
- Opacity of div’s background without affecting contained element in IE 8?
- Can you set a border opacity in CSS?
- image moves on hover – chrome opacity issue
- Select nth-child across multiple parents
- Background images: how to fill whole div if image is small and vice versa
- how to cancel opacity for a child element?
- Can I do knock-out/punch-through transparency with CSS fonts?
- how to handle ‘double opacity’ of two overlapping divs
- How to change the cursor into a hand when a user hovers over a list item?
- What does the CSS rule “clear: both” do?
- Why do browsers create vendor prefixes for CSS properties?
- Why do the :before and :after pseudo-elements require a ‘content’ property?
- Why doesn’t this a:visited css style work?
- CSS rule based on content [duplicate]
- height:100% VS min-height:100%
- Why does stacking order change on webkit filter hover?
- Forcing anti-aliasing using css: Is this a myth?
- Make CSS3 triangle with linear gradient
- object-fit, object-positioning and absolute positioning
- Safe width in pixels for printing web pages?
- CSS: equal height columns
- Purpose of *:before, *:after rule without content property