Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1675

How to make flex-box work with a nested child that needs truncated text?

$
0
0

To let a flex-child have truncated text with ellipsis one can give the parent an min-with:0. In my project the child is nested in almost 10 different flex containers. Do I need to give all parents a min-width:0 or is ther a better work around?

sandbox

body {  width: 400px;}.flex-parent {  display: flex;  padding: 10px;  border: solid;}.flex-parent-parent {  display: flex;  border: solid;  padding: 10px;}.flex-parent-parent-parent {  display: flex;  border: solid;  padding: 10px;}.long-and-truncated {  flex: 1;  white-space: nowrap;  overflow: hidden;  text-overflow: ellipsis;}
<div class="flex-parent-parent-parent"><div class="flex-parent-parent"><div class="flex-parent"><div class="flex-child long-and-truncated">        1. This is a long string that is OK to truncate please and thank you</div></div></div></div>

Viewing all articles
Browse latest Browse all 1675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>