【问题标题】:CSS wrap text not working in IECSS 换行文本在 IE 中不起作用
【发布时间】:2017-06-20 22:00:39
【问题描述】:

我遇到了一些在 Chrome 和 Firefox 中都可以正常工作的样式的问题,但在 IE 中却没有。

我面临的问题基本上是应用的特定样式在 Chrome 中可以正常工作,但在 IE 中却不行。文本不会自动换行。

如何重现它?先在 Chrome 或 Firefox 中查看this fiddle,然后在 IE 中查看。

为方便起见,请直接从此处尝试:

.Container {
  display: flex;
  text-align: center;
}
.column {
  flex-direction: column;
}
.row {
  flex-direction: row;
}
.jc-center {
  justify-content: center;
}
.column-item-x2 {
  width: 50%;
}
.jc-start {
  justify-content: flex-start;
}
.resume-item {
  padding-left: 10px;
  padding-right: 10px;
  padding-top: 4px;
  padding-bottom: 4px;
  border-radius: 7px;
  display: inline-block;
  position: relative;
  font-size: medium;
  right: 15px;
}
.dot {
  position: relative;
  display: inline-block;
  align-self: center;
  border-radius: 10px;
  height: 12px;
  width: 12px;
  right: 37px;
}
.dot-skill {
  display: inline-block;
  align-self: center;
  border-radius: 15px;
  margin-right: 3px;
  height: 15px;
  width: 15px;
}
.skill {
  margin-right: 5px;
  margin-bottom: 5px;
}
<div id="resume" class="Container column" style=" margin-top: 50px;">
  <span style="textAlign: left; fontSize: 40px; color: red;">
          <input type="checkbox" id="Resume-chk" style="display: none;" />
          <b id="Resume-title">RESUME</b>
        </span>
  <hr />
  <div class="Container row jc-center" style="margin-top: 30px;">
    <div class="Container column jc-start column-item-x2" id="professional" style="color: red;">
      <div class="Container row" style="border-left: solid 2px #B4B2B2; padding-left: 30px;">
        <div style="text-align: left;">
          <h2 style="color: red;">PROFESSIONAL</h2>

          <div class="Container column">
            <div class="Container row">
              <div class="dot" style="background-color: red;"></div>
              <div style={{ position: "relative" }}>
                <span class="resume-item" style="color: white; background-color: red;"><b>Nov 2016 - Present</b></span>
              </div>
            </div>
            <div style="text-align: left;">
              <h3>Web.com</h3>
              <p style="color: gray;">
                <span>
							Actualmente trabajo como Engineer III Fullstack .NET en Web.com,
							una compañía con fuerte posición en el mercado norteamericano de eCommerce. <br />
							Realizo mantenimiento y nuevos desarrollos tanto back-end como front-end
							del portal de ticketing de la compañía.
						</span>
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="Container column jc-start column-item-x2" id="personal" style="color: red;">
      <div class="Container row" style="border-left: solid 2px #B4B2B2; padding-left: 30px">
        <div style="text-align: left;">
          <h2 style="color: red;">SKILLS</h2>
          <div class="Container column">

            <div>
              <div class="Container row">
                <div class="dot" style="background-color: red;" />
                <div style="position: relative;">
                  <span class="resume-item" style="padding-left: 3px; padding-bottom: 6px; text-align: left; color: red;"><b>C#</b></span>
                </div>
              </div>
              <div class="Container row" style="margin-bottom: 20px;">
                <div class="dot-skill" style="background-color: red;" />
                <div class="dot-skill" style="background-color: red;" />
                <div class="dot-skill" style="background-color: red;" />
                <div class="dot-skill" style="background-color: red;" />
                <div class="dot-skill" style="background-color: red;" />
                <div class="dot-skill" style="background-color: red;" />
                <div class="dot-skill" style="background-color: red;" />
                <div class="dot-skill" style="background-color: red;" />
                <div class="dot-skill" style="background-color: red;" />
                <div class="dot-skill" style="background-color: #B4B2B2;" />
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="Container row" style="border-left: solid 2px #B4B2B2; padding-left: 30px;">
        <div style="text-align: left;" }}>
          <h3 style="color: red;">OTHER_SKILLS</h3>
          <div class="Container row" style="margin-left: 15px; flex-wrap: wrap;" }}>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">TDD</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">Scrum</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">MongoDB</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">ElasticSearch</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">Flux</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">Firebase</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">.Net MVC 5</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">REST Services</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">SOA</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">OAuth</span>
            <span class="resume-item skill" style="font-size: small; color: white; background-color: red;">ExpressJS</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

非常感谢。

【问题讨论】:

    标签: html css flexbox


    【解决方案1】:

    IE 在 flexbox 中出现换行问题。

    通常的解决方法是为容器定义一个宽度。

    不清楚的是:哪个容器?

    在这种情况下,这些调整似乎有效:

    #professional > .row > div { width: 100%; }
    
    #personal .row .row .row > div { width: 100%; }
    

    revised fiddle

    相关:Why IE11 doesn't wrap the text in flexbox?

    【讨论】:

    • 需要注意的是,如果你使用flex-direction: column,那么这个解决方案会让你设置元素height而不是width
    【解决方案2】:

    尝试:

    -ms-flex-wrap: wrap;
    
    flex-wrap: wrap;
    

    【讨论】:

    • 不幸的是它没有用。但是您获得此建议的标准是什么?
    猜你喜欢
    • 2013-09-28
    • 2012-09-23
    • 2010-09-09
    • 2010-10-10
    • 1970-01-01
    • 1970-01-01
    • 2014-10-07
    • 2012-07-30
    • 1970-01-01
    相关资源
    最近更新 更多