Menu Close

How to fix CSS text-overflow: ellipsis; not working?

To fix CSS text-overflow: ellipsis; not working, we should apply the text-overflow style to an inline-block element.

For instance, we write

.app a {
  height: 18px;
  width: 140px;
  padding: 0;
  overflow: hidden;
  position: relative;
  display: inline-block;
  margin: 0 5px 0 5px;
  text-align: center;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #000;
}

to make the a elements inline block with display: inline-block;.

Then we can apply the text-overflow: ellipsis; style.

Posted in CSS