Looking for a solution with CSS styling: I have a parent div element and two nested div elements, one containing an audio control of unknown length. My query is how to make the first nested div adjust its width based on the audio control.
The goal is for the title to display in a single line and be truncated if it goes beyond the intended width.
Currently, setting max-width to 100% does not work due to the undefined width of the parent div. Expansion of the parent div beyond the audio control's width needs to be prevented.
.outer: {
border: solid black 1px;
display: inline-block;
margin: 5px;
padding: 5px;
}
.audio_text: {
background-color: #888;
color: #f00;
max-width: 100%;
overflow: hidden;
white-space: nowrap
}
<div class="outer">
<div class="audio_text">My Title</div>
<div><audio src="audio.mp3" controls></audio></div>
</div>
Seeking guidance on keeping text from expanding the parent div size unnecessarily.