Problem with styling in IE and Firefox when using :active and :hover states

Encountering difficulties with a CSS-triggered overlay has left me frustrated. While the solution seems to be functioning adequately in Chrome, it is exhibiting minor issues in Firefox and proving completely nonfunctional in Internet Explorer.

In Firefox, the main issue arises with the :active property. It requires me to hold the mouse button down for 1-2 seconds in order to keep the overlay visible, whereas in IE, the overlay doesn't appear at all.

The HTML markup I'm working with is as follows:

<a href="#" id="aftermath" title="Mark Nielsen's 3D computer animation project developed at Aalborg Media College">                
                <article class="three columns"> 
                    <h1>
                        Aftermath
                    </h1>                                       
                    <img src="images/aftermath-video.jpg"  class="resize" alt="3D computer animation project by Mark Nielsen" />                    
                </article>                                
            </a>

<div class="infobox" id="aftermathinfo">
                <article>
                    <h1>
                        Aftermath
                    </h1>
                    <p class="truncate">This was the result of the "free project" from my stay at Media College Aalborg. Sebastian Baasch and I modelled this from a picture of an old army Jeep and did everything else ourselves. Besides modelling the Jeep and various objects in the landscape I also did all 2D graphics, editing and post effects.</p>
                    <p><a href="posts/aftermath-video.aspx" class="important-link" title="Mark Nielsen's 3D computer animation project devekoped at Aalborg Media College">See and read about the computer animation project here</a></p>
                    <p>&nbsp</p>
                    <p>&nbsp</p>
                    <p><a href="portfolio.aspx" title="Go look at Mark Nielsen's projects, including web page design, graphic design, programming and much more...">Close this window</a></p>
                </article>                
            </div>

and the corresponding CSS:

.infobox {
    position:fixed;
    top:0;
    left:0;
    /*margin-left:-300px;*/
    width:100%;
    height:100%;
    background: rgba(0, 0, 0,.75);
    visibility:hidden;
    z-index:9999;
}

    .infobox article {
        text-align:center;
        margin-top:10%;
        padding:5%;
        padding-bottom:20%;
        width:100%;
        background-color:#292929;
        opacity:0.95;
    }

        .infobox article p {
            text-align:center;
        }

        .infobox article h1 {
            border:none;
            margin:2% 0;
            padding:0;
            font-size:1.8em;
        }

    .infobox a.important-link {
        font-size:1.5em;
        /*text-transform:uppercase;
        font-style:normal;*/
    }

.infobox:hover {
    visibility:visible;
}



#aftermath:active + #aftermathinfo {
    visibility:visible;
}

You can view the live version here.

Answer №1

It seems like the behavior in question is rather ambiguous, possibly due to conflicting events within the browser's execution order. (Additionally, reloading the entire page upon closing an overlay is not ideal.)

You might want to consider utilizing the :target selector instead, which specifically targets an element when its corresponding fragment (#foo in the URL bar) matches the element's id. Simply adjust your link to <a href="#aftermathinfo"> (an improvement over just #) and update your final selector to #aftermathinfo:target. By linking the "close" option to just #, you can effectively clear the fragment and disable :target.

We can't guarantee full compatibility with older versions of IE, unfortunately. As you're already incorporating HTML5 elements, hopefully, there won't be any issues with outdated IE versions.

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

What is the best way to determine which button was clicked in Django?

My HTML has two buttons - one for accepting and the other for rejecting requests. I am trying to figure out how to determine which button was pressed along with the email of the applicant (tutor_application.tutor.chalkslateuser.email). Despite multiple a ...

What is the best way to display DT elements next to each other?

Here is a link to the code snippet: http://jsfiddle.net/ZcdkT/1/ The code renders as: DT-nameA DD-definitionA 1 DT-nameB DD-definitionB 1 DD-definitionB 2 I would like it to be formatted like this: DT-nameA DT-nameB DD-definitionA 1 ...

Stop scrolling when hovering over an element

I'm currently working on animating a scrolling div and have managed to get the trigger to fire, scroll, and stop on click and/or mouseenter. However, I am now looking to make it pause when the mouse hovers over the div instead of stopping altogether. ...

Run javascript code after the page has transitioned

Struggling to create a dynamic phonegap app with jQuery Mobile, the issue arises when loading JavaScript on transition to a new page. The structure of my index page is as follows: <body> <div data-role="page" id="homePage"> <div data- ...

Trigger a change event for a Material Checkbox by referencing its unique identifier

<div *ngFor="let cus of deselectedList | keyvalue" (click)="clickCheckBox('customer_'+cus.key+'_checkbox')"> {{cus.key}} <mat-checkbox id="customer_{{cus.key}}_checkbox" (change ...

How can I make an HTML button the default option within a form?

Currently, I am working on an asp.net page which contains a mix of asp.net buttons and HTML input[type=button] elements. These HTML buttons are specifically used to initiate AJAX calls. My dilemma arises when the user hits ENTER - instead of defaulting to ...

What other option is there instead of using a span tag?

Take a look at this illustration. <span id="s1">Goodbye</span> <span id="s2">cruel</span> <span id="s3">world</span> <span id="s4">this</span> <span id="s5">is</span> <span id="s6">a</sp ...

Is it possible for CSS to accurately crop images by pixels [Sprite Box]?

I attempted to replicate the math used for the previous image cuts and added my own image, but it appears blank. Can you identify where the issue lies? #paymentForm { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; -webk ...

Is there a way to direct to a specific URL upon clicking a button using PHP?

In my PHP code called registerprocess.php, it executes after clicking a submit button on another page named userregistration.php. If a user tries to register with an email that already exists in the database, I want registerprocess.php to redirect back to ...

including the current parameter from <select> within the URL

I have a HTML form with three <select> tags that populate data from a database. I would like to send a request to a URL in the following format when a button is pressed: /admin/{facultyName}/{specialtyName}/{groupName} Where facultyName repre ...

What is causing my browser to retrieve JSON response from Express?

Scenario: I've designed a website that features a form with a POST action. The objective is for users to input their email addresses into the form. Once an email is submitted, a POST request is dispatched to the server. By utilizing Express and the M ...

Having trouble with tabs in jQuery?

I'm having trouble setting up tabs in a reservation form with 3 tabs that include text boxes for user input. I can't seem to get it working properly and I'm not sure where I've gone wrong. Could it be due to the placement of the content ...

Use the nobr HTML tag on Django form fields

I have been customizing Django form fields using this helpful guide. Here is the form structure: class contact(forms.Form): first_name = forms.CharField() middle_name = forms.CharField() last_name = forms.CharField() This is how the template ...

Error encountered at /: Parsing error found for 'product.tk' in 'main-product-detail'product.tk'

I've encountered a persistent issue while trying to add links in my home.html files for the product detail page. An error keeps popping up: TemplateSyntaxError at / Unable to parse remaining: 'product.tk' of ''main-product-detail&a ...

What happens when Image Buttons are clicked in SAPUI5 and their onchange event is triggered

Is there a way to update the image on a button after it has been clicked? I want it to switch to a different image when activated. var offButton = new sap.ui.commons.Button({ id : "offIcon", icon : "img/off.png" , press :functio ...

Breaking a line within a list item will create additional spacing between the lines

Is there a way to break a line <br/> inside a <li> tag? For example: First line second line Second list item Third list item I've tried setting margin and padding to 0, but I still get an unwanted space between the lines. Any suggesti ...

"Implementing a JavaScript function to dynamically add multiple div elements to a

I am just starting to learn JavaScript. The main div with the ID "row_logic" contains two nested divs. I need help figuring out how to dynamically increment this root div in the format shown below using JavaScript. <div class="row-fluid" id="row_log ...

Does NgStyle work with a condition?

Could someone explain why this code block functions correctly: [style.height]="events?.length === 0 ? 'calc(100vh - 105px)' : null" while these two blocks do not work? [ngStyle]="{'height: calc(100vh - 105px)': events?.l ...

Arranging text links in a column format

I am attempting to align a series of text links vertically, but for some reason, some of the links are not stacking properly. Here is the current layout: https://i.sstatic.net/1gonA.jpg. This is how I want it to look: https://i.sstatic.net/oH0Ap.jpg Bel ...

Is there a method to implement lazy loading for the images within the CardMedia component in Material UI?

How can I implement lazy loading for the image within the CardMedia component? Is there a specific attribute I should use or any other method to achieve this? <CardMedia key={cardIndex} component="img" style={{objectFit: 'cont ...