JSFiddle - React, Tailwind, and code Playground
HTML
<h3>Longest name that fits will be visible</h3>
<div class="divA">
<div class="invisible_for_height"> </div>
<div class="divB">
<div class="under" title="Expectorating">Expectorating</div>
<div class="divC"> </div>
<div class="divD over">Expectorating</div>
</div>
</div>
<p>The view port will be a fraction of the screen width so you can resize. Notice that the hover text only shows up when the full string is not visible. <a href="http://stackoverflow.com">Read the explanation</a>.</p>
CSS
.under {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 50%;
position: absolute;
top: 0;
right: 0;
z-index: 1;
}
.over {
position: relative;
z-index: 2;
}
.divA {
width: 20%;
border: 1px solid #ccc;
position: relative;
overflow: hidden;
}
.divB {
position: absolute;
top: 0;
right: 0;
width: 200%;
height: 200px;
}
.divC {
width: 50%;
float: left;
}
.divD {
float: left;
background-color: white;
}
.invisible_for_height {
visiblility: hidden;
}