Skip to content Skip to sidebar Skip to footer

'display: Inline Block' Trick Not Working In Firefox

what I am trying to create is a full page website (no scrollbar) with a block of text/images/divs that centres both vertically and horizontally. I have researched and used a techni

Solution 1:

Just add the css rule below to your elements with inline style, it should fix it:

display: -moz-inline-stack;

Solution 2:

This is a working code which centers both vertically and horizontally in compliant browsers:

Demo

html, body {
    height: 100%;
    margin: 0;
}
.block {
    height: 100%;
    text-align: center;
}
.block:after, .centered {
    display: inline-block;
    vertical-align: middle;
}
.block:after {
    content: '';
    height: 100%; 
}

Based on Centering in the unknown.

Post a Comment for "'display: Inline Block' Trick Not Working In Firefox"