html - Firefox 吃掉了我的文本

标签 html css firefox

我真的需要你的帮助。我无法解决 Firefox 浏览器中的错误(当前版本是 45.0)。在某些未知条件下,部分文本 block 会丢失。

要了解它,请在 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>

太棒了!正如您在“少量示例”中使用 Firefox 看到的那样 - 没有数字 =(。但是 Chrome 工作正常!=)

请帮我解决一下!

最佳答案

将您的.amount 类修改为

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

您需要为省略号指定宽度,并且还需要指定所有 float 。

查看工作 fiddle

关于html - Firefox 吃掉了我的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36401891/

相关文章:

html - 如何在同一页面上运行多个关键帧

html - 容器高度不可缩放

javascript - 关于 Linux 上 Javascript 中的文件处理

html - UIActivityViewController 超链接

javascript - 如何在所选内容中间的文本突出显示上显示弹出窗口?

css - 我需要帮助在悬停时为这个 svg 设置动画

html - 调整大小/扩展幻灯片(在 div 内)覆盖下面的内容

javascript - onClick 事件不适用于 Firefox 中的 anchor 标记

css - Firefox li href CSS 选择器

html - 居中 Bootstrap 列