Button does not center in Safari

The button is not centered only in the Safari browser.

Jsfddle

HTML

<div class="" style=" width: 100%; ">
    <input value="Button" class="center-block" type="submit" style=""/>
</div>

CSS

.center-block {
display: block;
margin-right: auto;
margin-left: auto;
}

Above the problem, just go on a safari. In Chrome and Firefox, everything works fine.

+4
source share
1 answer

if you don't set the width for btn:

  • parent - text-align: center
  • button - use display:inline-blockinsteaddisplay: block

.wrap {
    text-align: center;
}
.center-block {
    display: inline-block;
}
<div class="wrap">
    <input value="Button" class="center-block" type="submit" />
</div>
Run codeHide result
+8
source

All Articles