css - flexbox | flex item being pushed out of containing div (off screen) -


i'm using flexbox layout style list of past tasks. task description , time going of variable lengths.

everything looks great until task description entered long enough wrap onto second line , 'time' item (on far right of screen) pushed right - off screen - hiding of content.

you can see short description displays below, long 1 pushes should '00:08' off screen , task description moves left well!!

flex-item-pushed-off-screen-chrome

here's a fiddle code (which below per stackoverflow's rules). if resize pane containing result '00:08' doesn't fall off page move far right.

the above screenshot in chrome or safari (the 2 browsers using) when shrinking width of window until description wraps onto second line.

i display per first (short description) line if possible! , understand why behaving is.

p.s. have tried using floats , using table display layout both of these techniques caused quite few bugs, because of variable length content (so please don't suggest these alternatives :)).

ul {        margin:0;        padding: 0;      }      #tasklist{        width: 100%;      }              .task-one-line{          display: flex;          flex-direction:row;          flex-wrap: nowrap;          justify-content: space-between;          align-item: baseline; /*flex-end*/          display: -webkit-flex;          -webkit-flex-direction:row;          -webkit-flex-wrap: nowrap;          -webkit-justify-content: space-between;          -webkit-align-item: baseline;           border-bottom: 1px solid #d3d3d3;          width: 100%;        }                .task-one-line i{            width:1.5em;            padding: 0.5em 0.3em 0.5em 0.3em;            /*border: 1px solid green;*/          }                  span.task-desc{              flex-grow: 5;              -webkit-flex-grow: 5;              text-align:left;              padding: 0.3em 0.4em 0.3em 0.4em;              /*border: 1px solid red;*/            }                       span.task-time{              flex-grow: 1;              -webkit-flex-grow: 1;              flex-basis:4em;              -webkit-flex-basis:4em;              text-align:right;              padding: 0.3em 0.5em 0.3em 0.5em;              /*border: 1px solid blue  ;*/            }
    <ul id="tasklist">          <li class="task-one-line">              <i class="fa fa-check-circle-o"></i>              <span class="task-desc">and short one</span>              <span class="task-time">00:01</span>          </li>          <li class="task-one-line">              <i class="fa fa-check-circle-o"></i>              <span class="task-desc">here's super long long long long long long description might wrap onto line</span>              <span class="task-time">00:08</span>          </li>      </ul>

really, want text content have flexible width (the time , icon should have fixed width , not shrink). pretty accomplished tables, absolute positioning, or flexbox.

here's flexbox need know:

.task-time: flex: 1 0 4em .task-one-line i.fa { flex: 0 0 auto; } 

ul {        margin:0;        padding: 0;      }      #tasklist{        width: 100%;      }              .task-one-line i.fa { flex: 0 0 auto; }        .task-one-line{          display: flex;          flex-direction:row;          flex-wrap: nowrap;          justify-content: space-between;          align-item: baseline; /*flex-end*/          display: -webkit-flex;          -webkit-flex-direction:row;          -webkit-flex-wrap: nowrap;          -webkit-justify-content: space-between;          -webkit-align-item: baseline;           border-bottom: 1px solid #d3d3d3;          width: 100%;        }                .task-one-line i{            width:1.5em;            padding: 0.5em 0.3em 0.5em 0.3em;            /*border: 1px solid green;*/          }                  span.task-desc{              flex-grow: 5;              -webkit-flex-grow: 5;              text-align:left;              padding: 0.3em 0.4em 0.3em 0.4em;              /*border: 1px solid red;*/            }                       span.task-time{              flex: 1 0 4em;              -webkit-flex: 1 0 4em;              text-align:right;              padding: 0.3em 0.5em 0.3em 0.5em;              /*border: 1px solid blue  ;*/            }
<ul id="tasklist">          <li class="task-one-line">              <i class="fa fa-check-circle-o"></i>              <span class="task-desc">and short one</span>              <span class="task-time">00:01</span>          </li>          <li class="task-one-line">              <i class="fa fa-check-circle-o"></i>              <span class="task-desc">here's super long long long long long long description might wrap onto line  long long long long long long description might wrap onto line</span>              <span class="task-time">00:08</span>          </li>      </ul>


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -