Skip to content

Instantly share code, notes, and snippets.

@kizu
Created June 19, 2013 20:04

Revisions

  1. kizu revised this gist Jun 19, 2013. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions dabblet.css
    Original file line number Diff line number Diff line change
    @@ -30,13 +30,15 @@
    background: rgba(255,0,0,0.25);
    }


    /* For Firefox */
    @-moz-document url-prefix() {
    .b-wrapper_fixed .b-shrinker {
    display: inline-flex;
    flex-direction:row-reverse;
    }
    .b-wrapper_fixed .b-shrinker__left {
    flex-shrink: 10000000;
    /* magic number, yeah, but… */
    /* it should be really big to override the bug */
    flex-shrink: 1000000000;
    }
    }
  2. kizu revised this gist Jun 19, 2013. 2 changed files with 5 additions and 12 deletions.
    15 changes: 4 additions & 11 deletions dabblet.css
    Original file line number Diff line number Diff line change
    @@ -32,18 +32,11 @@


    @-moz-document url-prefix() {
    .b-wrapper_fixed .b-shrinker__in {
    display: -moz-box;
    -moz-box-orient: horizontal;
    -moz-box-direction : reverse;
    .b-wrapper_fixed .b-shrinker {
    display: inline-flex;
    flex-direction:row-reverse;
    }
    .b-wrapper_fixed .b-shrinker__left {
    white-space: normal;
    word-break: break-all;
    -moz-box-flex: 1;
    height: 1.2em;
    }
    .b-wrapper_fixed .b-shrinker__right {
    -moz-box-flex: 1;
    flex-shrink: 10000000;
    }
    }
    2 changes: 1 addition & 1 deletion settings.json
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    {"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"html"}
    {"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
  3. kizu created this gist Jun 19, 2013.
    49 changes: 49 additions & 0 deletions dabblet.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    /* The most closest fix for the
    http://stackoverflow.com/q/7309593/885556 problem */

    .b-wrapper {
    padding-right: 10px;
    }

    .b-shrinker {
    display: inline-block;

    max-width: 100%;
    height: 1.25em;
    padding: 5px;
    margin: 0 0 5px;
    overflow: hidden;
    border: 1px solid blue
    }

    .b-shrinker__left {
    background: rgba(0,255,0,0.25);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    }

    .b-shrinker__right {
    float: right;
    margin: 0 0 0 5px;
    background: rgba(255,0,0,0.25);
    }


    @-moz-document url-prefix() {
    .b-wrapper_fixed .b-shrinker__in {
    display: -moz-box;
    -moz-box-orient: horizontal;
    -moz-box-direction : reverse;
    }
    .b-wrapper_fixed .b-shrinker__left {
    white-space: normal;
    word-break: break-all;
    -moz-box-flex: 1;
    height: 1.2em;
    }
    .b-wrapper_fixed .b-shrinker__right {
    -moz-box-flex: 1;
    }
    }
    38 changes: 38 additions & 0 deletions dabblet.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    <h2>Broken in Fx</h2>
    <p>Left part shrinks too much if it's shorter than right one.</p>
    <div class="b-wrapper">
    <div class="b-shrinker">
    <div class="b-shrinker__right">Right part</div>
    <div class="b-shrinker__left">Some very long string. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
    </div>
    <div class="b-shrinker">
    <div class="b-shrinker__right">Right part</div>
    <div class="b-shrinker__left">Short string</div>
    </div>
    <div class="b-shrinker">
    <div class="b-shrinker__left">Short string, no right part</div>
    </div>
    <div class="b-shrinker">
    <div class="b-shrinker__right">Long, long, long right part</div>
    <div class="b-shrinker__left">Short string</div>
    </div>
    </div>

    <h2>Fixed using some flexboxing:</h2>
    <div class="b-wrapper b-wrapper_fixed">
    <div class="b-shrinker">
    <div class="b-shrinker__right">Right part</div>
    <div class="b-shrinker__left">Some very long string. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
    </div>
    <div class="b-shrinker">
    <div class="b-shrinker__right">Right part</div>
    <div class="b-shrinker__left">Short string</div>
    </div>
    <div class="b-shrinker">
    <div class="b-shrinker__left">Short string, no right part</div>
    </div>
    <div class="b-shrinker">
    <div class="b-shrinker__right">Long, long, long right part</div>
    <div class="b-shrinker__left">Short string</div>
    </div>
    </div>
    1 change: 1 addition & 0 deletions dabblet.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    // alert('Hello world!');
    1 change: 1 addition & 0 deletions settings.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    {"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"html"}