opacity

How do I give text or an image a transparent background using CSS?

北城以北 提交于 2019-11-25 21:34:57
问题 Is it possible, using CSS only, to make the background of an element semi-transparent but have the content (text & images) of the element opaque? I\'d like to accomplish this without having the text and the background as two separate elements. When trying: p { position: absolute; background-color: green; filter: alpha(opacity=60); opacity: 0.6; } span { color: white; filter: alpha(opacity=100); opacity: 1; } <p> <span>Hello world</span> </p> It looks like child elements are subjected to the