2013年12月18日 星期三

[CSS] How to fix Margin Auto when Floating-Left Elements are involved

http://stackoverflow.com/questions/18329137/how-to-fix-margin-auto-when-floating-left-elements-are-involved

http://jsfiddle.net/kBqCJ/

<code>

<div class="page">
    <div class="container">
        <div class="box"></div>
        <div class="box"></div>
        <div class="box"></div>
    </div>
</div>


<style>
.page {
  width: 100%;
}

.container {
  width: 100%;
  display: block;
  margin: 0 auto;
    text-align: center;
}

.box {
  display: inline-block;
  width: 200px;
    height: 200px;
    background: grey;
}

</style>

</code>

沒有留言:

張貼留言

日常秘技小輯錄

媽媽傳授: 用爉燭塗在線上縫紉,可以更容易打結,以及拉縫線更順 爸爸傳授: 貼玻璃紙前在玻璃面塗上肥皂水,可以移動玻璃紙不留摺痕