html - CSS Clipping Text in Dynamic Header -


i've been trying dynamic header clip text using text-overflow:ellipsis, can't seem working need.

have @ we've implemented here https://dl.orangedox.com/selzde notice file name extends on controls, we're trying fix using text-overflow css property.

this i've tried

.toolbar {                width: 100%;                height: 45px;                background-color: #fff;                border-bottom: 1px solid #d5d5d5;              }                            .middle {                text-align: center;              }                            .left {                  text-align:left;              }                            .right {                  text-align:right;              }                            .border {                  border:thin solid silver;              }                            .clip {                overflow: hidden;                white-space: nowrap;                text-overflow: ellipsis;              }                            #float > div {                  width:32%;                  height:100%;              }                            #inline > div {                  position: absolute;                top: 0;                left: 0;                width: 100%;                height: 0;                overflow: visible;                margin-top: 3px;                }                            .hide {                  display:none;              }                            .float-right {                  float:right;              }                            .float-left {                  float:left;              }
    <div id='inline' class="toolbar">          <div class="inline left clip">              really really really really really really long line of text.          </div>          <div class="inline middle">middle stuff</div>          <div class="inline right">right stuff</div>      </div>            <br>      <hr>      <h3>second attempt</h3>      <br>         <div id='float' class="toolbar">          <div class="border left float-left clip">              really really really really really really long line of text.          </div>          <div class="border middle float-left">middle stuff</div>          <div class="border right float-right">right stuff</div>      </div>        <br>      <hr>      <strong>without middle</strong>      <br>         <div id='float' class="toolbar">          <div class="border left float-left clip">              really really really really really really long line of text.          </div>          <div class="border middle float-left hide">middle stuff</div>          <div class="border right float-right">right stuff</div>      </div>

having @ attempts i've tried above

  1. positioning correct , removing middle or right section allows left section "grow" text overflows in middle area (what we've implemented
  2. left box bounded 33% of screen allowing text overflow controlled but
  3. if middle box isn't present left box doesn't automatically resize on available space (since it's explicitly set @ 33%)

any ideas on how better structure header overflowing text & controls this?

edited answer: looks you'll need set width left div, without absolute positioning. other 2 can styled however. arrived there , believe end result you're looking for.

    #div1     {       display: inline-block;       width: 40%;       white-space: nowrap;       overflow: ellipsis;     }      #div2      {       position: relative;       width: 100px;       background: yellow;       top: -20px;       margin: 0 auto;     }      #div3      {        position: absolute;       top: 0;       left: 0;       width: 100%;       height: 20px;       overflow: visible;       margin-top: 5px;     } 

jsfiddle


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -