Assistance with CSS overlay in Internet Explorer

While my code works perfectly in Firefox and Safari, I am facing issues getting it to function properly in Internet Explorer. The overlay does not appear at all in IE. Can anyone assist me with troubleshooting this for IE?

http://pastebin.com/Kv4MbYyc
I had to use pastebin because the code tag formatting was not cooperating.

HTML:

<div class="image"> <img src="Picture.jpg"/> 
    <itext><span>Text at top</span></itext> 

    <stext><span>Text at bottom</span></stext> 
</div>

CSS:

.image {
    position: relative;
    width: 100%; 

}

itext span {
    position: absolute;
    Top: 20;
    left: 0.5em;
    width: 95%;
    font: bold 45px/75px Helvetica, Sans-Serif;
    color: #fff;
    background: rgb(0, 0, 0);
    background: rgba(0, 0, 0, 0.6);
    text-align: center;
}

stext span {
    position: absolute;
    Bottom: 0;
    left: 0.5em;
    width: 95%;
    font: 20px/30px Helvetica, Sans-Serif;
    padding:10px 20px;
    color: #FFFFFF;
    background: rgb(0, 0, 0);
    background: rgba(0, 0, 0, 0.7);
    text-align: Left;
}

Answer №1

It is recommended to utilize <div class="itext"> in place of <itext>, and <div class="stext"> instead of <stext>.

Furthermore, including the property display: inline will eliminate the necessity of using <span> altogether.

Answer №2

If you are looking to enhance HTML5 by incorporating custom tags, be aware that Internet Explorer does not support them. Instead, consider using a workaround such as utilizing the div tag along with an id. Below is an example of how you can implement this:

HTML

<div class="image"> <img src="Picture.jpg"/>
    <div id="itext"><span>Text at top</span></div>

    <div id="stext"><span>
        Text at bottom
        </span></div>

</div>

CSS

.image {
    position: relative;
    width: 100%;

}

#itext span {
    position: absolute;
    Top: 20;
    left: 0.5em;
    width: 95%;
    font: bold 45px/75px Helvetica, Sans-Serif;
    color: #fff;
    background: rgb(0, 0, 0);
    background: rgba(0, 0, 0, 0.6);
    text-align: center;
}

#stext span {
    position: absolute;
    Bottom: 0;
    left: 0.5em;
    width: 95%;
    font: 20px/30px Helvetica, Sans-Serif;
    padding:10px 20px;
    color: #FFFFFF;
    background: rgb(0, 0, 0);
    background: rgba(0, 0, 0, 0.7);
    text-align: Left;
}

View the example here: http://jsfiddle.net/q4CqZ/12/

In IE, you may notice that the background appears black. To achieve opacity in Internet Explorer, you can utilize the following code snippet:

opacity: 0.5;
filter: alpha(opacity = 50);

For more information, visit:

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

Although PhoneGap resolution remains consistent, the outcomes may vary

I seem to be facing a similar issue as discussed in this post on Stack Overflow: Screen Resolution On A PhoneGap App My problem is that I have both an iPad and an Android tablet, both with a resolution of 1024 pixels across. However, while my screen displ ...

Can the outcomes be showcased again upon revisiting a page?

Whenever I navigate away from and return to my filter table/search page, the results vanish. I'm looking for a way to preserve the results without reloading the page. Essentially, I want the page to remain as it was originally, with the search results ...

Minimize the gap between the input text and the lower border

Is there a way to bring the input text field and text closer together by reducing the space between the bottom border and the text? #a { padding: 1px 3px; background: transparent; border: 0; outline: 0; border-bottom: 0.8px soli ...

Stylish Titles with Bootstrap

I have been trying to eliminate the border that is creating the panels Body, but I am encountering some difficulties in locating it. Here is the code snippet for my panel: <div class="panel"> <div class="panel-heading"> <span class ...

The CSS content spills beyond the edge of the screen

I am facing an issue with aligning my content in the center as it is currently shifting to the right side and going off the screen. Below is the code snippet I am working with: <?php /* Template Name: About Us */ $aboutheading = get_field('abou ...

Choose the sequence in which CSS Transitions are applied

Currently facing an interesting challenge, but I'm confident there's a clever solution out there. The issue at hand is with a table that has three different sorting states for its columns: unsorted, where no icon should be displayed, ascending, ...

What does the letter "a" signify following a CSS class?

As someone who is still learning CSS, I have a question regarding the use of "a" after a class. In the code snippet below, what exactly does "a" refer to? .topnav { background-color: black; overflow: hidden; position: -webkit-st ...

Can the height of one div be determined by the height of another div?

Here's the specific situation I am facing: I want the height of Div2 to adjust based on the content of Div3, and the height of Div3 to adapt based on the content in Div2. The height of Div1 is fixed at 500px. Some of the questions that arise are: I ...

put two elements next to each other in a single row

This specific section contains an image positioned at the top, followed by two other components (within <ItemsContainer/>) at the bottom which display as separate rows. I am trying to place these two items (a grid and a chart) side by side within the ...

Adjust Side Navigation Bar based on window size alteration

I am currently working on implementing a side navigation bar for a website. At the moment, I am utilizing a <nav> element and populating it with <li> items to establish my sidebar. My code snippet is as follows (note: in-line styling is tempor ...

Using Ionic framework alongside Ionic View to display a beautiful background image

How can I display a full background image in Ionic 1.2? -hooks -platfroms -plugins -resources -scss -www -css -img -js -lib -templates ... Currently, I have the following HTML structure: <ion-view id="login" hide-nav-bar="true"> ...

Scrolling with jQuery just got a sleek upgrade with our new

Can anyone suggest a jQuery scrollbar that resembles the clean black bar found on the iPhone? I need a simple design without visible up or down buttons. Many scripts I came across offer more features than necessary for my project. My div element has a fi ...

Use jQuery to change the background color when clicked

Below is the HTML code with UL and LI elements: <UL> <LI><span id='select1'>Text</span></LI> <LI><span id='select2'>Text</span></LI> <LI><span id='select3'>Tex ...

What is the best way to include multiple font styles for different tags?

While working on a website project, the client requested to use Roboto as the main font (by Google). Different styles of Roboto such as Roboto Thin or Roboto Light were used for various elements on the page. However, I utilized the @font-face selector to e ...

The issue with the display grid position being set to absolute is causing functionality

Struggling to create an image catalog with cards containing text while using position absolute on the text and position relative on the card. Unfortunately, it's not working as expected. /*catalog style*/ .grid-container{ padding: clamp(5px,10vw,2 ...

Utilize jQuery to crop an image and instantly view a live preview

Currently, I am utilizing the jQuery imgareaselect plugin to exhibit an overlay that outlines the x and y co-ordinates. My intention is to utilize these values for real-time cropping of the image visible to the user. I believe determining the optimal stru ...

Implementing a click event on an image in an Angular 4 application

I'm facing an issue with adding a click event to an image within an Angular component. I have tried the following code: <img src="../../assets/add.svg" width="18" height="18" (click)="addItem()"> However, this approach does not seem to work as ...

Can we bring flexbox inserts, removes, and item positioning to life through animation?

This question was first raised in 2012, but the responses provided didn't address my specific situation (smooth transition for rearranging wrapped content). "After removing an item from a flexbox, the remaining items snap into their new positions imm ...

Animations experiencing delays on mobile Chrome

I am currently exploring the world of website animations. I have a version of the jsfiddle code linked below that is similar to what I am working on. The animations function perfectly when viewed on desktop, but when accessed on mobile - specifically on my ...

What could be the reason my div is not displaying correctly?

I am currently developing a game using HTML, CSS, and jQuery. The game will involve falling blocks that the player needs to avoid. However, I am facing an issue with my jQuery implementation. When selecting a theme (only the dark theme is currently functi ...