First child grow width of content until parent boundary invokes overflow ellipses

text-overflow
text-overflow ellipsis flex
text-overflow: ellipsis not working
flexbox
flex child overflows parent
flexbox overflow-y
text-overflow ellipsis without width
flex-grow

So a quick visual of what I'm trying to accomplish wherein the (gray) parent container is of variable width. The first child (red) is of variable auto width depending on its content until second child (green) reaches the end of the parent width wherein text-overflow: ellipses needs invoked on the first child (red) and the second child (green) always remains on the right of its sibling.

So first image example is if text isn't long enough to consume full width of parent. Second image is example of desired effect when first parent child does consume full width of parent container cell + width of sibling div.

The problem I keep running into no matter what I try between attempts using inline-block and flex on the child divs is that either it forces wrapping, the ellipses isn't displayed for overflow, or it tries pushing the parent passed 100% width. Notice no horizontal scrollbar should be necessary and table should invoke boundary at 100% width of the window, yet it does not...

The task is simple if the second child remains fixed to the right but how can I make the red box auto width until it reaches the containing parents end and then invoke overflow while keeping the green child on the right of it's sibling?

Quick example of the struggle (Notice green child is consumed by overflow:hidden and no longer visible in first cell);

table {
  width: 100%;
}

th {
  border: gray 1px dotted;
  text-align: left;
  height: 1rem;
  overflow: hidden;
  text-overflow: ellipses;
  white-space: nowrap;
}

div {  
  border: red 3px dashed;
  min-width: 3rem;
  overflow: hidden;
  text-overflow: ellipses;
  white-space: nowrap;
  background-color: rgba(red, .2);  
}

div:nth-child(1) {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipses;
  white-space: nowrap;
}

div:nth-child(2) {
  border: green 3px dashed;
  background-color: rgba(green, .2);
  display: inline-block;
}
<table>
  <thead>
    <tr>
      <th>
        <div>
          Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing  
        </div>
        <div>
          Blah
        </div>
      </th>
      <th style="width: 300px">
        <div>
          Another COLUMN
        </div>
      </th>
    </tr>
  </thead>
</table>

You can do this with flexbox like below:

.container {
  display:flex;
  border:2px solid;
  width:500px;
}
.container > div:last-child {
  width:100px;
  border:2px solid green;
  flex-shrink:0;
}
.container > div:first-child { 
  border:2px solid red;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
<div class="container">
  <div>some text</div>
  <div></div>
</div>
<div class="container">
  <div>some text some text some text some text some text some text some text some text</div>
  <div></div>
</div>

CSS Flex positioning gotchas: child expands to more than the width , It seems like the parent does not control the width anymore. I expected its width to be constrained as flex-grow: 1 should only allow is still not constrained until you set an explicit min-width (or an explicit width ) on the flex child. so if you want child2 content to be shown as ellipsis on overflow, you can't  The overflow-wrap CSS property applies to inline elements, setting whether the browser should insert line breaks within an otherwise unbreakable string to prevent text from overflowing its line box. The source for this interactive example is stored in a GitHub repository.


If you apply display: flex to the container to align the items side-by-side, you could then apply flex-shrink: 0 to the green child to be sure that it maintains its size as the red div expands.

div.container { 
  display: flex;
}

div.div1 {
  border: 2px solid red;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

div.div2 {
  border: 2px solid green;
  width: 100px;
  flex-shrink: 0;
}
<div class="container">
  <div class="div1">
    test test test 
  </div>
  <div class="div2"></div>
</div>

<div class="container">
  <div class="div1">
    test test test test test test test test test test test test
    test test test test test test test test test test test test
    test test test test test test test test test test test test
  </div>
  <div class="div2"></div>
</div>

Flexbox and Truncated Text, Situation: you have a single line of text in a flex child element. Skip to main content wrap, you want it truncated with ellipsis (or fall back to just hiding the overflow). <div class="flex-parent"> <div class="flex-child"> Text to truncate here. Safari was shrinking/truncating even without the min-width (against spec, I think). commit: 24708939d35c50acb6e29cba17010c59f8f8969c [] [author: jam@chromium.org <jam@chromium.org@4ff67af0-8c30-449e-8e8b-ad334ec8d88c> Thu Dec 09 01:56:15 2010


  1. Set table-layout: fixed so your table uses 300px for 'Another Column' and the remaining space (100% - 300px) for the first two columns.
  2. Use the correct value for text-overflow (ellipsis not ellipses)
  3. Set the first th to display: flex and remove height: 1rem which truncates the contents of the cell.

table {
  table-layout: fixed;
  width: 100%;
}

.flex {
  display: flex;
}

th {
  border: gray 1px dotted;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

div {  
  border: red 3px dashed;
  min-width: 3rem;
  overflow: hidden;
  text-overflow: ellipses;
  white-space: nowrap;
  background-color: rgba(red, .2);  
}

div:nth-child(1) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

div:nth-child(2) {
  border: green 3px dashed;
  background-color: rgba(green, .2);
}
<table>
  <thead>
    <tr>
      <th class="flex">
        <div>
          Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing Testing  
        </div>
        <div>
          Blah
        </div>
      </th>
      <th style="width: 300px">
        <div>
          Another COLUMN
        </div>
      </th>
    </tr>
  </thead>
</table>

`flex-grow` is weird. Or is it?, As it turns out, the problem wasn't the CSS, but the content (or lack of content). or shrinks them (proportionally to their flex shrink factor) to prevent overflow. First we set the display property of our parent element to flex and by doing that our flex-grow value and the result is added to each child elements initial width. Thanks Tab. Given how much usage of -webkit-line-clamp there is, it's really only (1) that I consider urgent here. Even though it's not ideal and we might not choose to ship such a new API now without also doing (2), that ship has effectively sailed - might as well document and test that as a first step, then (if it's important enough) iterate on improving and extending it.


portaldocs/top-design-responsive.md at master · Azure/portaldocs , First child grow width of content until parent boundary invokes overflow ellipses div { border: red 3px dashed; min-width: 3rem; overflow: hidden; text-overflow: ellipses; solid red; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } By default, after showing the first Gtk::Window, GTK+ calls gdk_notify_startup_complete(). Call this function to disable the automatic startup notification. You might do this if your first window is a splash screen, and you want to delay notification until after your real main window has been shown, for example.


Use csstype for standardized CSS typings · Issue #411 · paypal , That min-width, when inferred, is 585px, while it can also be adjusted via the The portal has been re-engineered with a small resolution first philosophy in mind. To activate this tool, invoke the portal developer tools as described previously. For a child content not to overflow its parent, the child content size must be at  Search metadata Search text contents Search TV news captions Search archived web sites Advanced Search. upload UPLOAD; Full text of "CSS Notes for Professionals"


Expand div on scroll, The border-image-width CSS property defines the offset to use for dividing the border Specifies the ordinal group that a child element of the object belongs to. to the flex factors described in the flex property (flex-grow and flex-shrink). The text-overflow shorthand CSS property determines how overflowed content that is  Contents Beyond Recognition: A Real Vulnerability versus a Bug Conclusion Chapter 19 Instrumented Investigation: A Manual Approach Philosophy Oracle extproc Overflow Common Architectural Failures Problems Happen at Boundaries Problems Happen When Data Is Translated Problems Cluster in Areas of Asymmetry Problems Occur When Authentication and