Skip to content

Instantly share code, notes, and snippets.

@nksm
Last active September 26, 2015 06:32
Show Gist options
  • Save nksm/208f069d23c6a1e9b799 to your computer and use it in GitHub Desktop.
Save nksm/208f069d23c6a1e9b799 to your computer and use it in GitHub Desktop.

Revisions

  1. nakashima akira revised this gist Sep 26, 2015. 3 changed files with 72 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions button タグで flexbox を利用する.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    button タグで flexbox を利用する
    ------------------------
    button タグで flexbox で中央揃えをしようとした場合、Safari だとレンダリング結果が違う。

    A [Pen](http://codepen.io/nksm/pen/wBeGxW) by [nakashima akira](http://codepen.io/nksm) on [CodePen](http://codepen.io/).

    [License](http://codepen.io/nksm/pen/wBeGxW/license).
    16 changes: 16 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    .container
    header.header
    h1.title button タグで flexbox を利用する
    p.description button タグで flexbox を利用し、テキストを中央揃えをしようとした場合、Safari だとレンダリング結果が違う。

    section
    header
    h1 flexbox を利用しない
    button.btn button タグにテキスト
    div.btn div タグにテキスト

    section
    header
    h1 flexbox を利用する
    button.btn.btn--flex button タグにテキスト
    div.btn.btn--flex div タグにテキスト
    49 changes: 49 additions & 0 deletions style.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    @import "compass/css3";

    .container {
    width: 500px;
    margin: auto;
    background-color: transparent;
    }

    .header {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #000;
    }

    .title {
    margin: 10px;
    font-weight: bold;
    }

    .description {
    margin: 10px;
    line-height: 1.7;
    }

    section {
    margin-top: 10px;
    margin-right: 10px;
    margin-bottom: 20px;
    margin-left: 10px;
    }

    .btn {
    width: 300px;
    height: 100px;
    &--flex {
    display: flex;
    align-items: center;
    justify-content: center;
    }
    }

    button {
    -webkit-appearance: none;
    border: 0;
    }

    div {
    background-color: #ccc;
    }
  2. nakashima akira revised this gist Jan 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion button-タグで-flexbox-を利用する.markdown
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    button タグで flexbox を利用する
    ------------------------
    button タグで flexbox で中央揃えをしようとした場合、Safari だとレンダリング結果が違う。
    button タグにて flexbox を利用し中央揃えをしようとした場合、Safari だとレンダリング結果が違う。

    A [Pen](http://codepen.io/nksm/pen/wBeGxW) by [nakashima akira](http://codepen.io/nksm) on [CodePen](http://codepen.io/).

  3. nakashima akira created this gist Jan 23, 2015.
    7 changes: 7 additions & 0 deletions button-タグで-flexbox-を利用する.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    button タグで flexbox を利用する
    ------------------------
    button タグで flexbox で中央揃えをしようとした場合、Safari だとレンダリング結果が違う。

    A [Pen](http://codepen.io/nksm/pen/wBeGxW) by [nakashima akira](http://codepen.io/nksm) on [CodePen](http://codepen.io/).

    [License](http://codepen.io/nksm/pen/wBeGxW/license).
    11 changes: 11 additions & 0 deletions index.jade
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    section
    header
    h1 flexbox は利用しない
    button.btn テキスト
    div.btn テキスト

    section
    header
    h1 flexbox を利用する
    button.btn.btn--flex テキスト
    div.btn.btn--flex テキスト
    23 changes: 23 additions & 0 deletions style.scss
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    @import "compass/css3";
    section {
    margin-bottom: 20px;
    }

    .btn {
    width: 100px;
    height: 50px;
    &--flex {
    display: flex;
    align-items: center;
    justify-content: center;
    }
    }

    button {
    -webkit-appearance: none;
    border: 0;
    }

    div {
    background-color: #ccc;
    }