IE5 Vertical Align

701 Views Asked by At

I am working on a project for a scanner which runs IE5 (yeah I know!) and they have requested that a link should be a block element with a height. Inside this block, they want the it's contents to be aligned to the centre both vertically and horizontally.

I have this html (for one):

<a class="block cancel vertical-align text-center" href="#" id="btn-cancel">
    <h4>Cancel</h4>
</a>

and the SCSS for that is:

.block {
    display: inline-block;
    *zoom: 1;
    *display: inline;

    height: 100%;
    width: 100%;
    background-color: #3C60EF;

    .block-content {
        padding: 4px;

        > h1, > h2, > h3, > h4, > h5 {
            margin-top: 0;
        }

        @media screen and (min-width: 992px) {
            padding: 10px;
        }
    }
}

.block.vertical-align {    
    display: table-cell;
    vertical-align: middle;

    h3, h4, h5, h6, p, .block-content {
        padding: 0 10px !important;
    }

    form {
        .form-group {
            margin: 0;
        }
    }
}

a.block {    
    background-position: center center;
    background-repeat: no-repeat;
}

.text-center {
    text-align: center;
}

this works fine on my machine (using latest browsers) but on the scanner everything is aligned to the top.

Can anyone suggest anything that might help me?

1

There are 1 best solutions below

0
Dan Winter-Wijntjes On
<style>
.text-center {
    text-align: center;
}

.fullFrame{
    width: 100%;
    height: 100%;
}
</style>

<table class="fullFrame">
    <tr>
        <td class="text-center">

<a class="block cancel vertical-align text-center" href="#" id="btn-cancel">
<h4>Cancel</h4>
</a>

        </td>
    </tr>
</table>

This will make the cancel link in the vertical and horizontal centre of the page. I could only check as low as IE6 and it seemed to work. Not sure about IE5, but i don't know why you would want to try support that, as it is very out of date.