Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox eats my text

Tags:

html

css

firefox

I really needs your help. I can not beat a bug in a Firefox browser (current version is 45.0). Under certain unknown conditions, part of the text block is lost.

To understand it, check out the following snippet in Firefox and Chrome browser.

.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>

Cool! As you can see with Firefox in "short amount example" - There are no numbers =(. But Chrome working fine! =)

Please help me to fix it!

like image 913
north.inhale Avatar asked Jun 20 '26 18:06

north.inhale


1 Answers

Modify your .amount class to

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

You need to specify width for ellipsis to work and also all the floats need to specified.

See working fiddle

like image 99
ihimv Avatar answered Jun 23 '26 09:06

ihimv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!