CSS styling to show end of single text string

Here is a flex solution without changing direction:

.demo {
  border: 1px solid red;
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  display: flex;
  justify-content: flex-end;
}
<p class="demo">hello this is a string</p>


If you want the end of the string to show and hide the beginning, you can add the direction:rtl; property.

.demo {
    border: 1px solid red;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    direction:rtl;
}
<p class="demo">hello this is a string</p>


.demo {
    border: 1px solid red;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    direction: rtl;
}
<p class="demo">hello this is a string</p>

Tags:

Html

Css

Overflow