-1

Not much to comment here ... I'm trying to set the text-overflow to an ellipsis on a div, while having a fixed div with a background somewhere else on the page, which doesn't seem to be working in Firefox (but does work with Chrome) ... Here's the code :

.fixed {
  position: fixed;
  background-color: #fff;
}

.ellipsis {
  width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
<div class="fixed">
  asdf
</div>
<div class="ellipsis">
  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</div>

1 Answers1

0

use overflow: hidden and white-space: nowrap for the fixed div.

check the snippet

.fixed {
  position: fixed;
  background-color: #fff;
  top: 50px;
  
  width: 120px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  
}

.ellipsis {
  width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
<div class="fixed">
  this is the demo text to rere
</div>
<div class="ellipsis">
  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</div>
Lucian
  • 1,715
  • 3
  • 17
  • 26