Text is not wrapping inside flexbox in IE EDGE

社会主义新天地 提交于 2019-12-24 09:37:21

问题


I have a UL set to display: flex and lists with flex-grow: 1, so that all items will take equal spacing.

Inside each list item, I have a link set with display: flex, justify-content and align-items set to center.

When the window is too small to display all items, text inside the LINK will wrap in Chrome and FF but not in IE Edge :(

I have not found a solution so far. All help is much appreciated.

* {
  box-sizing: border-box;
}
ul {
  display: flex;
  margin: 0;
  padding: 0;
}
li {
  list-style: none;
  flex-grow: 1;
}
li:hover a {
  background: #000;
}
a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: #ffcc00;
  text-align: center;
  height: 60px;
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: auto;
}
<ul>
  <li><a href="#">NAME HERE</a></li>
  <li><a href="#">NAME HERE 2</a></li>
  <li><a href="#">NAME HERE 2222</a></li>
  <li><a href="#">NAME HERE 100000</a></li>
  <li><a href="#">NAME HERE</a></li>
</ul>

回答1:


Add display: flex to the li.

Revised Codepen



来源:https://stackoverflow.com/questions/38113527/text-is-not-wrapping-inside-flexbox-in-ie-edge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!