3 column display:flex layout with overflow:ellipsis
Tag : html , By : CrimsonGore
Date : March 29 2020, 07:55 AM
will be helpful for those in need Important part is to use flex: 1 and overflow: hidden on .details and white-space: nowrap, text-overflow: ellipsis on .address #container .list ul {
list-style-type: none;
margin: 0;
padding: 0;
border: 1px solid black;
}
#container .list li {
padding-top: 20px;
padding-bottom: 20px;
border-bottom: 1px solid #a1d1b8;
display: flex;
justify-content: space-between;
}
#container .list li > div {
vertical-align: middle;
}
#container .list .type {
padding-right: 15px;
flex: 0 0 50px;
background: green;
}
#container .list .type i {
font-size: 40px;
}
#container .list .details {
flex: 1;
overflow: hidden;
font-family: "Courier New";
}
.address {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#container .list .value {
padding-left: 15px;
font-size: 55px;
}
#container .list .details .date {
font-weight: bold;
margin-bottom: 5px;
}
<div id="container">
<div class="list">
<ul>
<li>
<div class='type'><i class='fa fa-arrow-circle-right'></i></div>
<div class='details'>
<div class='date'>date</div>
<div class='address'>1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111</div>
</div>
<div class='value'>1.2</div>
</li>
</ul>
</div>
</div>
|
Issues combining display:flex, tables, and text-overflow: ellipsis
Tag : html , By : user165781
Date : March 29 2020, 07:55 AM
will help you You should switch to the other table layout algorithm: table-layout: fixed, the one that does what the author (you) says and doesn't try to adapt automagically to content. If you're having problems with widths set, try to set them on first row. Also max-width property on cells has no effect AFAIK. Oops no, it's undefined behavior. I changed it to width: 55% which is kind of fine here on SO but I guess your page is larger than snippets here so YMMV. /* flex layout */
.flex-space-between {
display: flex;
justify-content: space-between;
}
.flex-space-between > div {
width:100%;
flex: 1 1 auto;
}
.flex-with-gap { margin: -14px -7px; }
.flex-with-gap > div { margin: 14px 7px; }
/* colouring and other styles */
.flex-space-between > div {
box-sizing:border-box;
background-color:white;
border: solid 1px #999;
padding: 0.5em;min-width: 0;
}
body { font-family: sans-serif }
.truncate {
width:100%;
display: inline-block;
color:red;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.t1 {
width: 100%;
border-collapse:collapse;
table-layout: fixed;
}
.t1 TD, .t1 TH {
border:1px dotted blue;
}
.t1 TH {
text-align:left;
font-weight:normal;
}
.t1 .number {
text-align:right;
font-size: 180%;
color:#66F;font-weight:bold;
}
.t1 .text {
width: 55%;
background: yellow;
}
.info { color: blue; font-style:italic;}
<div class='flex-space-between flex-with-gap'>
<div>
<div class='truncate'>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam.</div>
<p class='info'>The div.truncate element above truncates fine.</p>
</div>
<div>
<div class='flex-space-between'>
<div class='truncate'>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam.</div>
<div class='truncate'>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam.</div>
</div>
<p class='info'>So do the above which are contained inside sub-flexboxes.</p>
</div>
<div></div>
<div></div>
</div>
<div class='flex-space-between flex-with-gap'>
<div></div>
<div>
<table class='t1'>
<tr>
<th class='text'>Locations</th>
<td class='number'>123</td>
</tr>
<tr>
<th class='text'>Divisions</th>
<td class='number'>123</td>
</tr>
<tr>
<th class='text'>Business Units Business Units Business Units</th>
<td class='number'>80</td>
</tr>
</table>
<p class='info'>Now, I'm wanting to place a small table in my flex items as above (lists of text and numeric values) but I want the text (e.g. Business Units) to truncate if has to, and not wrap.</p>
</div>
<div>
<table class='t1'>
<tr>
<th class='text'>Locations</th>
<td class='number'>123</td>
</tr>
<tr>
<th class='text'>Divisions</th>
<td class='number'>123</td>
</tr>
<tr>
<th class='text'><div class='truncate'>Business Units Business Units Business Units</div></th>
<td class='number'>80</td>
</tr>
</table>
<p class='info'>But this is what now happens when trucating. The "white-space: nowrap;" kicks in but not the "overflow: hidden;" nor "text-overflow: ellipsis;".</p>
<p class='info'>
I think truncating text inside a TD/TH is the problem but not sure why.
</p>
</div>
<div style='opacity:0.9'></div>
</div>
<div class='flex-space-between flex-with-gap'>
<div>100%</div>
</div>
<div class='flex-space-between flex-with-gap'>
<div>33%</div><div>33%</div><div>33%</div>
</div>
<div class='flex-space-between flex-with-gap'>
<div>50%<br>Multi-line line</div><div>50%</div>
</div>
<div class='flex-space-between flex-with-gap'>
<div>25%</div><div>25%</div><div>25%</div><div>25%</div>
</div>
|
Why doesn't text-overflow: ellipsis not work with display: inline-flex in Firefox?
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I was able to reproduce your issue. Turns out the issue was with the display:inline-block; property. Below is the part that I modified: #breadcrumbs a,
#breadcrumbs span {
/*display: inline-block;*/
text-decoration: none;
}
|
CSS: display: inline-flex and text-overflow: ellipsis not working togethier
Tag : html , By : Fernando
Date : March 29 2020, 07:55 AM
|
Combining text-overflow:ellipsis with display:flex
Tag : html , By : user160048
Date : March 29 2020, 07:55 AM
|