Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical centering in Safari

I've got a problem with vertical centering in Safari, using margin: auto 0; on a div which is nested inside a div with display: inline-flex;

It works just fine in Firefox, Chrome, Opera... but fails in Safari (and on the default Android browser but I'm considering using a separate CSS for that and whatever iPads use)

Here's the code (I am using Bootstrap, btw): http://jsfiddle.net/n2V5q/1/

<div class="container-fluid head" id="slide1">
    <div class="col-md-6 logo">
        <img src="img/logo.png" alt="THE LOGO" />
    </div>
</div>

and

 .container-fluid {
    margin-right: auto;
    margin-left: auto;
    padding-left: 15px;
    padding-right: 15px;
}

.head {
    color: #fff;
    width: 100%;
    min-height: 100rem; /* for Opera */
    min-height: 100vh;
    padding: 15px;
    background-color: rgba(85,61,148,.9);
    box-shadow: 0px 0px 6px #000000;
    z-index: 90;
    position: relative;
    background-image: url('../img/dither2.png');
    background-position: center bottom;
    background-repeat: repeat-x;
    display: -o-flex;
    display: -ms-flex;
    display: -moz-flex;
    display: -webkit-flex;
    display: inline-flex;
}

.col-md-6 {
    position: relative;
    min-height: 1px;
    padding-left: 15px;
    padding-right: 15px;
}

.logo {
    margin: auto 0;
    text-align: center;
}
like image 596
lambdacore Avatar asked Apr 15 '14 13:04

lambdacore


People also ask

How do you center a vertical view?

The simple and quick answer is to add android:gravity="center_vertical" to the parent(containing) view.

How do I align NAV to center vertically?

Add text-align:center to <li> or <a> to center the links. Add the border property to <ul> add a border around the navbar. If you also want borders inside the navbar, add a border-bottom to all <li> elements, except for the last one: Home.


1 Answers

try it in you head class

 display: -webkit-inline-box;
    -webkit-box-pack: center;
    -webkit-box-align: center;
like image 172
Piyush Marvaniya Avatar answered Sep 17 '22 18:09

Piyush Marvaniya