Issue with utilizing display: table and overflow: hidden in Internet Explorer and Firefox, functioning properly on Webkit and Blink

JSFiddle : http://jsfiddle.net/h7xvr2t9/2/


I have been experimenting with ways to achieve some effects:

  • Animating a hidden DIV to slide into view from below a visible container
  • Centering text/image on a link to trigger the animation

HTML

<div class="outer">
    <div class="inner">
            <a id="clickerthing" href="#" class="click">click</a>
            <div class="hidden">
                you can't see me until after the click... 
            </div>
    </div>
</div>

CSS

div {
    border: thin dashed black;
}

.outer {
    float: left;
    width: 235px;
    background-color: red;
}

.inner {
    text-align: center;
    position: relative;
    height: 200px;
    overflow: hidden;
    display: table;
    width: 100%;
}

.click {
    display: table-cell;
    height: 100%;
    width: 100%;
    vertical-align: middle;
    background-color: yellow;
}

.hidden {
    position: absolute;
    width: 100%;
    height: 100%;
    bottom: -200px;
    left: 0px;
    text-align: left;
    background-color: #FFF;
    transition: all 0.3s ease-in-out 0s;
}

.clicked {
    bottom: 0;
}

The current code utilizes display: table and display: table-cell for proper content positioning in links and DIVs. However, Firefox and IE behave differently than Chrome/Safari. The hidden DIV is consistently visible in the former browsers while it remains hidden in Chrome/Safari, respecting the overflow: hidden CSS property.

My main query is: which browser interpretation is correct? I have not been able to find a definitive answer, as most responses only offer specific solutions that are not universally applicable.

Keep in mind...

I have observed that enclosing the container within another div hides elements as desired, but the reasoning behind this behavior is still unclear: http://jsfiddle.net/h7xvr2t9/3/

Answer №1

To achieve the desired effect, you can implement it without using a wrapping div element.

Check out the code snippet here

div {
    border: thin dashed black;
}

.outer {
    float: left;
    width: 235px;
    background-color: red;
    overflow:hidden
}

.inner {
    text-align: center;
    position: relative;
    height: 200px;
    display: table;
    width: 100%;
}

.click {
    display: table-cell;
    height: 100%;
    width: 100%;
    vertical-align: middle;
    background-color: yellow;
}

.hidden {
    position: absolute;
    width: 100%;
    height: 100%;
    bottom: -200px;
    left: 0px;
    text-align: left;
    background-color: #FFF;
    transition: all 0.3s ease-in-out 0s;
    }

.clicked {
    bottom: 0;
}

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

Variables defined within a React useEffect are not accessible outside of the function

I'm facing a scope issue where I need to declare a constant variable inside the useEffect hook in React, but the variable is not recognized outside the function. import React, { useEffect } from "react"; function Commentsbox(props) { useEffect(( ...

Issue with Safari: Unable to trigger CSS :hover when tapping SVG element

On an iOS device in Safari, tapping this SVG element does not trigger the transition animation to fade in the replacement <g id="training-sub-menu">. The animation is confirmed to work, as there is a strange behavior where long-pressing whe ...

Generating a dynamic triangle within a div while ensuring it fits perfectly with the maximum width

I need help with creating a responsive triangle on a web page that takes three inputs. The challenge is to adjust the size of the triangle so it fits inside a div element while maintaining the aspect ratio of the inputs. For instance, if the inputs are 500 ...

Send data from input to controller without using $scope

I am encountering an issue with the code below. Typically, I would resolve this problem using $scope, but this time I have been asked to find a solution without utilizing $scope in the controller. I am implementing the "controller as" syntax for managing ...

Is there a way to send all the results of a Flask database query to a template in a way that jQuery can also access

I am currently exploring how to retrieve all data passed to a template from a jQuery function by accessing Flask's DB query. I have a database table with customer names and phone numbers, which I pass to the template using Flask's view method "db ...

Embed a hyperlink within an informational passage

I have a search box with Ajax functionality like this; And I want to customize the NotfindText message to display as: "No results found, but you can try advanced search from here" However, I am struggling to add the link. I do not have much knowledge abo ...

Adjust the object's width and position based on the window's width

I am currently attempting to adjust the width of a box and the position of a btn based on the size of the window. Q1. How can I eliminate the excess white space located behind the scroll bar? (I have already set it to 100%..) Q2. After clicking the ...

Safari does not support SVG fill pattern, unlike Firefox and Chrome

Having an issue with Safari 6.1.5 not displaying a pattern in an SVG rectangle. After simplifying the code, here is the test case: <html> <head> <style> .patterned { fill: url("#myid") none; stroke:blue} ...

Variable assigned by Ajax no longer accessible post-assignment

Recently, I've written a script to fetch data from a SQL database and now I'm in the process of creating a JS wrapper for it. Utilizing certain functions, I call the script and extract information from the DB as soon as it becomes available. var ...

Child Component featuring an Accordion group implemented with ngx-bootstrap

Primary Component <input type="button" class="btn btn-primary" (click)="allExpanded = !allExpanded" [attr.value]="allExpanded ? 'Collapse All': 'Expand All'" > <div class=& ...

AngularJS showing up as normal text

I can't seem to get angular JS working properly on my website. It keeps displaying as plain text in the browser and doesn't receive any information from the app2.js. I've double-checked all the dependencies and their locations in my code, so ...

The height and rows of a textarea element do not adjust properly to the content in FireFox

Looking for a way to create a textarea with dynamic height that adjusts as the user adds new content? The resize property is set to none and overflow is hidden. It seems to be working correctly in Chrome, but Firefox is presenting some mysterious issues wi ...

What is the most effective method to convert PHP data into JSON and present it in the jQuery success scenario?

In the realm of jQuery, I have this particular piece of code: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script> <script type="text/javascript" > $(function() { $("input[type ...

Using Python Selenium to create a login page with Javascript

Attempting to access a page using Python selenium package for certain activities is proving challenging. Despite the following code being written, an error message of "the Class is not found" keeps appearing. To proceed with using send_keys(), it's ne ...

VIDEOJS ERROR: A peculiar mistake has occurred. TypeError: The property 'value' cannot be read since it is undefined in the context of

Recently, I came across a fascinating plugin called videojs-thumbnails for video.js, and I'm eager to incorporate it into my angular component. However, I keep encountering an error that says: VIDEOJS: ERROR: TypeError: Cannot read property 'val ...

Executing a Vue method from the main.js file within a Vue.js document

Why can't I call my method in App.vue? Shouldn't the div with id='App' in the App file allow me to access methods within it? Main.js new Vue({ render: h => h(App), methods:{ gesamt:function () { return 'Hello&a ...

Problems arise with identification of asynchronous functions

My async functions have been used successfully in various projects, but when incorporating them into a new project, they suddenly stopped working. One of the functions causing trouble is: const ddbGet = async (params) => { try { const data ...

How CSS can affect the layout of elements on a webpage

I am looking to achieve something similar to this: The left box should maintain a fixed width, while the right one resizes to fit the full width of the browser window. I also need the height of both boxes to be resizable. Apologies for any inconvenience ...

Create a project using Next.js and integrate it with the tailwindcss framework

My application utilizes TailwindCSS and NextJs. I am facing an issue where certain classes are not working after running npm run start, following a successful run of npm run dev. For example, the classes h-20 / text-white are not functioning as expected, w ...

Create a fixed content scroll effect with an inset box-shadow

I recently stumbled upon a solution at Stack Overflow that effectively created an inset box shadow beneath content. However, I encountered an issue when the outer container div needed to be scrolling due to overflow - the inner div with the box shadow woul ...