I've got span inside parent div, which inside has structure in order: span, button, span.
My goal is that span fits parent div, keep in the same line (does not wrap), truncate text inside span and button and not change the html structure.
Below is code snippet, in which the span with its content fits the parent div width. The problem is with button text, which does not truncate. When the width is not enough, the button just dissapears. Nevertheless, when it stands alone, it truncates as it should.
.box {
border: 3px solid red;
outline: 3px solid rosybrown;
padding: 10px;
display: inline-block;
width: 200px;
}
.header {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.btn {
width: 100%;
margin: 0 0 20px 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.inside-box {
border: 2px solid blue;
display: block;
padding: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.btn-2 {
flex-direction: row;
margin: 5px 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: auto;
}
<div class="box">
<div>
<h3 class="header">Content Header Name</h3>
</div>
<div>
<button class="btn">Click me click me click me click me click me!</button>
</div>
<span class="inside-box">
<span>Before Text</span>
<button class="btn-2">Click me!</button>
<span>After Text</span>
</span>
</div>
