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

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *