CSS, the vertical alignment feature is not functioning properly in Mozilla Firefox

Creating a webpage with fixed height header and footer, and a contentWrapper div in between that stretches to the maximum screen height. The content div inside the contentWrapper needs to be vertically and horizontally aligned within its parent div. This solution works in Chrome and IE but not in Firefox (version 22.0).

Check out this fiddle for reference: http://jsfiddle.net/qWYqb/

Any suggestions on how to fix this for Mozilla Firefox?

HTML:

<div id="pageWrapper">
            <header>
                <div id="logo">
                    Logo
                </div>        
            </header>
            <div id="contentWrapper">
                <div class="valignMiddle">
                    <div id="content">
                        <form>
                            <table>
                                <tbody>
                                    <tr>
                                        <td><label for="fullName">Full Name</label></td>
                                        <td><input id="fullName" type="text" name="fullName" required="required" /></td>
                                    </tr>
                                    <tr>
                                        <td><label for="email">E-mail</label></td>
                                        <td><input id="email" type="email" name="email" required="required" /></td>
                                    </tr>
                                </tbody>
                            </table>
                            <div>
                                <input type="submit" id="submit-go" value="Start Now"/>  
                            </div>                
                        </form>  
                    </div>
                </div>
            </div>
            <nav>    
                <ul>
                    <li><a href="#" class="btn1">Option1</a></li>
                    <li><a href="#" class="btn2">Option2</a></li>
                </ul>
            </nav>
        </div>

CSS

* {
    margin: 0;
    padding: 0;
    outline:none;
}
html, body{
    min-height: 100%;
        margin: 0;
    padding: 0;
}

table
{
    border-collapse: collapse;
    border-spacing: 0;
}

td, th {
    vertical-align:top;
}

body{
    background-color: #E3E3E3;
}
/* This padding is there to stop margin collapsing */
div {
    padding: 1px 0;
}

#pageWrapper{
    position:absolute; top:0; bottom:0; left:0; right:0;
    padding: 126px 0 100px 0;
    margin: 0 auto;
    width: 400px;
    overflow: hidden
}

/* --- HEADER --- */
header{ 
    width: 100%;
    height: 126px;
    margin-top:-126px;
    background: yellow;
}

/* --- MAIN CONTENT --- */
#contentWrapper{
    width: 100%;
    position: static; 
    display: table; 
    overflow: hidden; 
    min-height: 100%;
    background: red;
}

.valignMiddle { 
    position: static; 
    display: table-cell; 
    vertical-align: middle; 
    width: 100%; 
}

#content{
    width: 293px;
    margin: 0 auto;
    background: green;
}

/* --- NAVIGATION --- */
nav {
    width: 100%;
    height: 100px;
    margin-bottom:-100px;
    background: pink;
}

nav li {
    display: inline-block;
    list-style: none outside none;
}

nav ul {
    text-align: center;
}

Answer №1

Take a look at the live demo here: Demo

#contentWrapper{
    width: 100%;
    position: static; 
    display: table; 
    overflow: hidden; 
    min-height: 100%;
    height: 100%;
    background: red;
}

It works perfectly in Firefox. Is this what you were searching for?

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 get_attribute function fails to execute in Python when using Selenium

I seem to be having some difficulty extracting an element from a web page using Selenium and Python The particular div I am targeting looks like this: <div class="col-sm-6 col-lg-4 broker-details"> <div class=" "> ...

Node.js route error: no script MIME types allowed with 'X-Content-Type: nosniff' header present

I'm facing an issue where my css and js files do not load on the second route, but they work perfectly fine on the first route. Could someone explain why this discrepancy occurs? // ********************** INDEX PAGE ******************************* ...

When it comes to HTML and Javascript drawing, getting the positioning just right can be a challenge

I'm currently developing a control website for a drawing robot as part of a school project. However, I've been facing some challenges with the functionality of the drawing feature. Though I admit that the site lacks attention to detail, my main ...

Exploring Problems with Implementing the Jquery .click() Function on a Class

My goal is to create a simple JQuery code that triggers a pop-up message saying hello when any element of the specified class is clicked. Here's what I've tried: $(document).ready(function(){ $(".thumb_radio").click(function(){ aler ...

The conditional statement within the EventListener does not seem to be functioning as intended

I am attempting to calculate BMI and then display additional information on the calculation result when a button is clicked. The 'what does this mean' button should show information based on the calculated BMI score. const generatebutton = doc ...

The Mapbox JS SDK stylesheet leads to the sudden disappearance of the map

Incorporating the Mapbox JavaScript SDK into my VueJS app has been successful in displaying a map. Now, I am looking to enhance it by adding markers. According to this page, importing a CSS stylesheet is necessary for markers to function properly. I have a ...

Modifying JavaScript Code in Inspect Element Editor

When I modify the HTML content using Chrome's Inspect Element editor, any changes made are immediately visible. However, when I make changes to the JavaScript code, the modifications do not take effect. For example, if I have a button that triggers a ...

If the PHP upload process is complete, restart the form

Is there a way to refresh my form or page after uploading a file without any issues? I want to clarify that the HTML file is stored in the root directory and the PHP file is stored in root/php/upload_action.php Below is my HTML code: <form enctype="mu ...

Randomly position a div within a grid

I am currently working on creating a grid that spans 100% of the width of the browser window. Firstly, I am unsure about how to approach this grid creation, and secondly, I would like to have a div randomly positioned within the grid, filling the space onl ...

Can the w3 validator be configured to disregard PHP tags?

I am facing issues with the online validator flagging errors for my php tags. To validate my HTML, I currently have to manually remove all the php inserts which is quite time-consuming. Is there a more efficient way to handle this problem? Below is an e ...

Issue: The login.component.html file failed to load

I attempted to utilize a custom-made HTML file with the templateUrl attribute in Angular2. Below is the content of my login.component.ts file: import {Component} from '@angular/core'; @Component({ selector: 'login' , template ...

What is the best way to incorporate an HTML element using JavaScript?

My attempt to generate a chip when a checkbox is checked by adding an event listener function to the checkbox seems to be failing. It appears that the element is not being inserted into the HTML. Below is the code snippet: let ChoosenFiltercontainer = docu ...

How can you activate CSS intellisense for ASP.NET .cshtml files in VS Code?

Recently, I added the "HTML CSS Support" extension to my VS Code, but it seems like it's only compatible with files having a .html extension. Unfortunately, I've been facing difficulties in getting it to work properly with .cshtml files unless I ...

Unusual hue in the backdrop of a daisyui modal

https://i.stack.imgur.com/fLQdY.png I have tried various methods, but I am unable to get rid of the strange color in the background of the Modal. Just for reference, I am using Tailwind CSS with Daisy UI on Next.JS. <> <button className='btn ...

Enhance your Zara shopping experience with the dynamic image zoom-in

I am currently exploring ways to replicate the image zoom-in feature seen on Zara's product pages. To see this effect in action, visit their site: Upon clicking on the image, it opens up in a popup window where it is enlarged to fit the entire screen ...

Design the appearance of page buttons distinct from select buttons

I am currently working on styling my paging buttons differently from the select buttons. However, the selector I am using for the select buttons is also being applied to the paging buttons: .gridView tr td a{} /* The gridView class has been assigned to th ...

"Unlocking the Power: Bringing Data from the Backend to the Frontend with ASP.NET OnClick

As I delve into the code of my current project, I find myself deciphering the work of a previous developer. Specifically, I am grappling with the usage of Eval in HTML forms. Within my HTML form, there is an onclick action that triggers the download of a ...

What is the reason behind the lack of style for the pills in Bootstrap 4?

I attempted to create a vertical navbar using Bootstrap 4 pills, but unfortunately, the styles were not appearing as expected. Instead, all the pills appeared as regular links. Pills without any styling: <ul class="nav nav-pills flex-column"> &l ...

Update the content on the webpage to display the SQL data generated by selecting options from various dropdown

My database table is structured like this: Name │ Favorite Color │ Age │ Pet ────────┼────────────────┼───────┼─────── Rupert │ Green │ 21 │ ...

Issue with Bootstrap 4 Navbar collapsing and not expanding again

Help needed! My navigation bar collapses when the window is resized, but clicking on the hamburger icon does not open it back up. I have included my code below. Can someone please provide guidance on how to expand the collapsed navbar? <html lang=&quo ...