Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>opacity</code> style affects the whole element and everything within it. The correct answer to this is to use an rgba background colour instead.</p> <p>The CSS is fairly simple:</p> <pre><code>.myelement { background: rgba(200, 54, 54, 0.5); } </code></pre> <p>...where the first three numbers are the red, green and blue values for your background colour, and the fourth is the 'alpha' channel value, which works the same way as the <code>opacity</code> value.</p> <p>See this page for more info: <a href="http://css-tricks.com/rgba-browser-support/">http://css-tricks.com/rgba-browser-support/</a></p> <p>The down-side, is that this doesn't work in IE8 or lower. The page I linked above also lists a few other browsers it doesn't work in, but they're all very old by now; all browsers in current use except IE6/7/8 will work with rgba colours.</p> <p>The good news is that you can force IE to work with this as well, using a hack called <a href="http://css3pie.com/">CSS3Pie</a>. CSS3Pie adds a number of modern CSS3 features to older versions of IE, including rgba background colours.</p> <p>To use CSS3Pie for backgrounds, you need to add a specific <code>-pie-background</code> declaration to your CSS, as well as the PIE <code>behavior</code> style, so your stylesheet would end up looking like this:</p> <pre><code>.myelement { background: rgba(200, 54, 54, 0.5); -pie-background: rgba(200, 54, 54, 0.5); behavior: url(PIE.htc); } </code></pre> <p>Hope that helps.</p> <p>[EDIT]</p> <p>For what it's worth, as others have mentioned, you can use IE's <code>filter</code> style, with the <code>gradient</code> keyword. The CSS3Pie solution does actually use this same technique behind the scenes, but removes the need for you to mess around directly with IE's filters, so your stylesheets are much cleaner. (it also adds a whole bunch of other nice features too, but that's not relevant to this discussion)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload