Firefox吃我的文字

时间:2016-04-04 11:53:32

标签: html css firefox

我真的需要你的帮助。我无法击败Firefox浏览器中的错误(当前版本为45.0)。在某些未知条件下,部分文本块将丢失。

要了解它,请查看Firefox和Chrome浏览器中的以下代码段。



.fluid {
  font-family: sans-serif;
  text-align: center;
  padding: 10px 0;
  background-color: #ccc;
  margin-bottom: 30px;
}
.price {
  float: left;
  margin-right: 5px;
  color: #454545;
}
.valuta {
  float: right;
  font-weight: bold;
  margin-left: 5px;
  color: #161616;
}
.amount {
  overflow: hidden;
  white-space: nowrap;
  -ms-text-overflow: ellipsis;
  text-overflow: ellipsis;
  font-weight: bold;
  color: #161616;
}
.align {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  text-align: left;
  max-width: 100%;
}
.center-block {
  margin: 0 auto;
  width: 300px;
}
*:before, *:after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.clearfix:before,
.clearfix:after {
    content: " ";
    display: table;
}
.clearfix::after {
    clear: both;
}

<!-- This is an example especially for comparison of Firefox browser display it in other browsers. The amount field is not displayed correctly in Firefox free browser, with a portion of the text is lost -->

<!-- Short amount example -->
<div class="fluid">
  <div class="center-block">
    <div class="align clearfix">
      <div class="price">Price:</div>
      <div class="valuta">$</div>
      <div class="amount">25 600</div>
    </div>
  </div>
</div>

<!-- Long amount example -->
<div class="fluid">
  <div class="center-block">
    <div class="align clearfix">
      <div class="price">Price:</div>
      <div class="valuta">$</div>
      <div class="amount">25 600 25 600 25 600 25 600 25 600 25 600 25 600 25 600</div>
    </div>
  </div>
</div>

<!-- Long amount without spaces example -->
<div class="fluid">
  <div class="center-block">
    <div class="align clearfix">
      <div class="price">Price:</div>
      <div class="valuta">$</div>
      <div class="amount">1234567890000000000000000000000000000000000000000000000</div>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

酷!正如你在Firefox中所看到的那样,&#34;简短的例子&#34; - 没有数字=(。但Chrome工作正常!=)

请帮我解决一下!

1 个答案:

答案 0 :(得分:2)

将您的.amount课程修改为

.amount {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: bold;
    color: #161616;
    max-width: 200px;
    float: left;
}

您需要指定省略号的宽度才能工作,并且还需要指定所有浮点数。

见工作fiddle

相关问题