Opacity in IE 8 will impact every child element within

I need to apply opacity to a div element. Here is my current CSS:

background: rgb(255, 255, 255); /* Fallback for non-rgba supporting browsers */
background: rgba(255, 255, 255, .7);
filter: alpha(opacity=70); /* For IE 7 and older versions */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; /* For IE8 */
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70);

While this works as expected in most browsers, it causes the child elements within the div to also become transparent in IE 8.

I have already checked a similar question on Stack Overflow, but the solutions provided there did not solve my issue.

If anyone has any suggestions or alternative approaches, I would greatly appreciate your input.

Thank you!

Answer №1

Internet Explorer 8 does not support RGBa, and using MS Filter opacity will impact both the element and its children.

A recommended solution can be found at http://css-tricks.com/rgba-browser-support/

<!--[if IE]>

   <style type="text/css">

   .color-block { 
       background:transparent;
       filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#50990000,endColorstr=#50990000); 
       zoom: 1;
    } 

    </style>

<![endif]-->

OR (using conditional classes)

<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

   .ie8.your-selector { 
       background:transparent;
       filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#50990000,endColorstr=#50990000); 
       zoom: 1;
    } 

OR

One alternative is to use a 1px by 1px transparent png that repeats as the background image for the element..

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The names in the lists appear with a visible scrollbar, making them easily

I'm having some issues with this dropdown menu. http://jsfiddle.net/vnr0rbuu/2/ The problem arises when using a different mouse or a PC, as the scrollbar appears and my list items don't apply the inline-block style correctly. Any suggestions on ...

Using CSS and HTML to dynamically show rows in a horizontal line and create a new row when necessary

Can you arrange 3 table rows to display inline, so that after every 3 rows the table will automatically start on a new line and continue like this indefinitely? <?php $addon_name = $_SESSION['Add_On_OpName']; mysqli_report(MYSQLI_REPORT_INDEX ...

Lines that are next to each other within an svg path and have a stroke

I'm working with an SVG that contains multiple lines within a path element. <path stroke-width="13" stroke="black" fill="orange" d="M 100 100 L 300 100 Z L200 300 z"/> Due to the stroke-width, the lines a ...

Is it possible to create a dynamic <hr /> using Flexbox?

In the midst of working on my application, I managed to achieve a simple layout. However, there is one peculiar requirement that has been eluding me for the past 2 days and now I find myself in need of assistance. Here is the current HTML code I am workin ...

Is there a way to customize the look of the time selected in the <input matInput type="time" step="1" /> time picker?

Currently, I am utilizing the following code as a time picker in my Angular 9 application. My goal is to modify the selected time's color to a bright blue shade. How can I accomplish this task? <input matInput type="time" step="1&quo ...

Clicking within the text activates the dropdown menu, but clicking outside the text does not

My custom drop down menu is not functioning properly. When I click on the text, it successfully links to another place, but when I click beside the text, it does not link. Can you please help me identify what's wrong here? Your assistance would be gre ...

Elements on the page appear and disappear as you scroll down

Whenever my scroll reaches the bottom of element B, I want my hidden sticky element to appear. And when I scroll back up to the top of element B, the sticky element should be hidden again. Here are my codes: https://i.sstatic.net/J49dT.jpg HTML <htm ...

Hover over images for cool effects

Check out the code snippet I created on this link The current functionality enlarges images by 20 percent and overlaps into the table on hover. How can I enlarge both the image and table dimensions simultaneously? Below is the HTML code: <table borde ...

Volume slider missing on Handel?

I'm having an issue with my volume slider in jQuery - the handle is not showing up despite it working. Any suggestions on how to make the handle visible? The jQuery I have imported: <script src="jquery-3.4.1.min.js"></script> <script ...

Tips on displaying a single column in Bootstrap when only one item is present and switching to two columns when two items are present

Currently, I am utilizing the row class in Bootstrap which contains two columns, one for X and one for Y. There are scenarios where either the X column, the Y column, or both may be present within the row. Since a row can have up to 12 columns, when only t ...

Why Chrome Doesn't Alter the State of li Elements

I'm unsure why, but the CSS code in this particular fiddle fails to function correctly on Chrome. On Firefox, when hovering over one of the li elements, the text becomes visible as expected, whereas this does not occur on Chrome. It seems that changin ...

What causes the discrepancy in margin values between desktop and mobile devices?

In my project, I have a collection of div elements that need to be spaced vertically from one another by the height of the window plus an additional 100px. However, I encountered a discrepancy when setting this margin using jQuery between mobile and deskto ...

Guidelines on isolating the navigation bar from the rest of the webpage

Being new to web development, I am currently working with Django framework in VSCode. My goal is to create a user interface for a web application that features a left side menu and a top navigation bar that says "home page" (see image below). I want all te ...

Wrap link column data in a bootstrap table for a seamless display

Is there a way to make a link in a table cell wrap and respect the column width I provide? When data in a table cell is a link, it doesn't seem to let me specify the column width. How can this be achieved? <link href="https://cdn.jsdelivr.net/np ...

The H1 tag is mysteriously displaying padding or margin on the bottom, despite not being set

Despite not setting any padding or margin for the H1 tag, it still appears to have some spacing at the bottom. After applying a margin and padding of 0 to both the h1 tag and the text below it, I am still facing an issue where the text doesn't align ...

Using iedriverserver.exe to manage Edge in IE Mode with VBA scripting

Are there any code examples available for controlling Edge in IE Mode using iedriverserver.exe in VBA? I have the exe downloaded but am having trouble adding the necessary library to tools->reference in my VBA project. If anyone has experience with thi ...

Acquiring Twitter updates for a dynamic Bootstrap carousel display

I've been trying to load multiple tweets from the stream into the slideshow, but I can only get one to show up. I believe it has to do with the placement of the <div id="feed"> element, but I can't seem to figure out what I'm missing. ...

Preventing the Rendering of Inline-Block Whitespace in Web Browsers

Essentially, in my attempt to create a four-column layout, I have the following HTML code: <div> <div>A column</div> <div>A column</div> <div>A column</div> <div>A column</div> </div ...

Stop the anchor tag from activating Chrome's status bar

I've been working on a web application with an elastic layout where the footer acts as a toolbar and information display. The footer is always visible at the bottom of the page, without any need for scrolling. We specifically chose this location for t ...

Only the first column of a row in Flexbox will have a line break when exceeding the

Currently, I am utilizing flex with a row direction for a set of items with fixed widths causing overflow and a horizontal scrollbar, which is the desired outcome. Nevertheless, my requirement is for the first column in these rows to be full-width, while ...