What I'm trying to accomplish is a title that fills the available parent width of the div, but if its copy does not fit in the div, it should truncate with ellipsis. In addition, it should have an icon after it, which should not disappear when truncated, but is always displayed after the ellipsis.
Another requirement is that the parent div must have one or more buttons of odd width that remain in the right corner, but if the div is resized, it must crop a long title bar, allowing the icon to show next to the ellipsis, as I described earlier.
Visually, my desired result is as follows: 
So far I have achieved the following results:
.flag { display: table; width: 100%; } .flag .flag__section { display: table-cell; vertical-align: middle; } .text-right { text-align: right !important; } .container { background-color: #55606d; color: #333; padding: 20px; } .flag__section--a { background-color: #22d398; } .flag__section--b { background-color: #91c1f8; } .fluid-text__icon { background-color: #fecb52; } .container { max-width: 700px; } .fluid-text { text-align: left; } .fluid-text__inner { max-width: 100%; } .fluid-text__inner, .fluid-text__copy { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .fluid-text__copy, .fluid-text__icon { float: left; } .fluid-text__copy { padding-right: 5px; } .fluid-text__icon { margin-top: 30px; } .title { max-width: 600px; }
<div class='container'> <div class='flag'> <div class='flag__section flag__section--a fluid-text'> <div class='fluid-text__inner'> <h1 class='fluid-text__copy title'> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque earum in, voluptas dolorum sit ab modi facere tempora est, sequi molestiae! Commodi vitae sapiente ipsum, nisi facilis impedit aut? Repellendus! </h1> <span class='fluid-text__icon'>icon</span> </div> </div> <div class='flag__section flag__section--b text-right'> <button>ACTION</button> </div> </div> </div>
However, my only problem is that I have to explicitly set .title max-width , which is not scalable, and I would like to avoid it.
Is there any way to do this without js?
source share