1

I am new to flexbox and trying to get some text to ellipsis.

Instead it is stretching the container.

Also if I did not design the html properly for using flexbox please let me know. Thanks!

body,
html {
  margin: 0;
}


/*want exactly full page*/

.page {
  display: flex;
  height: 100vh;
  width: 100vw;
}

.flex-container {
  display: flex;
  flex: 1;
}


/*create column container of fixed height/width*/

.column {
  display: flex;
  flex-direction: column;
  /*not growing or shrinking so height should stay fixed*/
  flex: 0 0 100%;
}

.overflow {
  overflow-y: auto;
}

.item {
  flex: 1;
}


/*fixed 50 px item*/

.header {
  width: 100%;
  flex: 0 0 50px;
  background-color: #00cab1;
  color: white;
}

.footer {
  flex-basis: 50px;
}

.ellipsis {
  /*this causes the container to strech in the x axis, so how do I get the text to ellipsis*/
  white-space: nowrap;
  overflow-x: hidden;
  text-overflow: ellipsis;
}
<div class="page">
  <div class="flex-container">
    <div class="column">
      <div class="header">Header text</div>
      <div class="item overflow">
        <div>This contains a lot of items want it to scroll:</div>
        <div>s</div>
        <div>s</div>
        <div class="ellipsis">Large amounts makes this container stretch and I do not know why. Please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
      </div>
    </div>
  </div>
  <div class="flex-container">
    <div class="column">
      <div class="header">Header 2 text</div>
      <div class="item overflow">
        <div>This cointains a lot of items want it to scroll:</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
        <div>s</div>
      </div>
      <div class="footer">4</div>
    </div>
  </div>
</div>

https://jsfiddle.net/2kypet5e/

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
Chris
  • 1,299
  • 3
  • 18
  • 34
  • An initial setting on flex items is `min-width: auto`. This means that a flex item cannot be shorter than the width of its content. To override this setting use `min-width: 0` or `overflow` with any value other than `visible`. https://jsfiddle.net/2kypet5e/1/ – Michael Benjamin Jul 25 '17 at 15:21
  • 1
    thank you!. I saw the min-midth answer but i put it on the wrong css class (item not the container). – Chris Jul 25 '17 at 16:24

0 Answers0