Text doesn't wrap in evenly distributed, even width flexbox

switz

Here's a sample: https://jsfiddle.net/gxhb2xnu/1

.container {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100vh;
}

.column {
  flex: 1;
  background: red;
  margin: 0 4px;
  height: 100%;
}
<div class="container">
  <div class="column">foõ foõ foõ foõ foõ foõ</div>
  <div class="column">foõ</div>
  <div class="column">foõ</div>
  <div class="column">foõ</div>
  <div class="column">foõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõ</div>
</div>

As you can see the last column adjusts its width to accomodate the text. I'd like every column to have an equal width and to just break mid-word onto the next line.

I tried flex-basis: 0 and word-wrap: break-word;, but it doesn't seem to affect it.

Sahil Dhir

There were few mistakes that I have corrected.

  1. Fixed the flex properties in the column divs.
  2. Use word-break:break- word

Below is the working code.

.container {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100vh;
}

.column {
  flex-grow: 1;
  flex-basis: 0;
  background: red;
  margin: 0 4px;
  height: 100%;
  word-break: break-word;
}
<div class="container">
  <div class="column">foõ foõ foõ foõ foõ foõ</div>
  <div class="column">foõ</div>
  <div class="column">foõ</div>
  <div class="column">foõ</div>
  <div class="column">foõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõfoõ</div>
</div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

text consisting of words longer than max-width in label doesn't wrap, even with max-width, word-break and overflow-wrap defined

From Dev

CSS div with full width but doesn't wrap text

From Dev

CSS Text doesn't wrap?

From Dev

max-width doesn't work in flexbox

From Dev

css flexbox wrap property doesn't work on ios6

From Dev

<a> doesn't wrap span, and appears as text

From Dev

Text doesn't wrap, breaks layout instead

From Dev

Text ellipsis doesn't show on flexbox item

From Dev

Flexbox - fluid column with "no wrap" text

From Dev

Even width of Text and Textfield

From Dev

Make fixed width flexbox items wrap correctly

From Dev

Column flexbox: wrap to width limit, then grow height?

From Dev

Maximum width of <pre>, not wrap text

From Dev

Why doesn't the "text-justify: align" method for evenly spaced menus work?

From Java

Text in a flex container doesn't wrap in IE11

From Dev

PDF doesn't wrap text lines automatically & respect line position

From Dev

TextView inside TableLayout and TableRow doesn't wrap text

From Dev

TextBlock text doesn't wrap when placed inside a ViewBox

From Dev

Text doesn't wrap in IE 11 flex layout

From Dev

Paragraph text doesn't wrap around to next line

From Dev

Flexbox in combination with IE10: doesn't work when I wrap the children in a div and a href container

From Dev

Text will not wrap inside my flexbox container

From Dev

TextBlock doesn't show Text even after Binding

From Dev

TextBlock doesn't show Text even after Binding

From Dev

vba text into textbox doesn't fit with it width and height

From Dev

Dynamically created text inputs doesn't resize width

From Dev

text area width and height doesn't change in table cell

From Dev

Set text_field width, style works but class doesn't

From Dev

Flexbox: Why flex-grow doesn't work with fixed width sibling?

Related Related

  1. 1

    text consisting of words longer than max-width in label doesn't wrap, even with max-width, word-break and overflow-wrap defined

  2. 2

    CSS div with full width but doesn't wrap text

  3. 3

    CSS Text doesn't wrap?

  4. 4

    max-width doesn't work in flexbox

  5. 5

    css flexbox wrap property doesn't work on ios6

  6. 6

    <a> doesn't wrap span, and appears as text

  7. 7

    Text doesn't wrap, breaks layout instead

  8. 8

    Text ellipsis doesn't show on flexbox item

  9. 9

    Flexbox - fluid column with "no wrap" text

  10. 10

    Even width of Text and Textfield

  11. 11

    Make fixed width flexbox items wrap correctly

  12. 12

    Column flexbox: wrap to width limit, then grow height?

  13. 13

    Maximum width of <pre>, not wrap text

  14. 14

    Why doesn't the "text-justify: align" method for evenly spaced menus work?

  15. 15

    Text in a flex container doesn't wrap in IE11

  16. 16

    PDF doesn't wrap text lines automatically & respect line position

  17. 17

    TextView inside TableLayout and TableRow doesn't wrap text

  18. 18

    TextBlock text doesn't wrap when placed inside a ViewBox

  19. 19

    Text doesn't wrap in IE 11 flex layout

  20. 20

    Paragraph text doesn't wrap around to next line

  21. 21

    Flexbox in combination with IE10: doesn't work when I wrap the children in a div and a href container

  22. 22

    Text will not wrap inside my flexbox container

  23. 23

    TextBlock doesn't show Text even after Binding

  24. 24

    TextBlock doesn't show Text even after Binding

  25. 25

    vba text into textbox doesn't fit with it width and height

  26. 26

    Dynamically created text inputs doesn't resize width

  27. 27

    text area width and height doesn't change in table cell

  28. 28

    Set text_field width, style works but class doesn't

  29. 29

    Flexbox: Why flex-grow doesn't work with fixed width sibling?

HotTag

Archive