Skip to content Skip to sidebar Skip to footer

Css Styling To Show End Of Single Text String

I have a long text string. How do I get all the text to show on one line and with a certain width, but limit what is shown to the end of the string? Here it shows the beginning of

Solution 1:

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;
}
<pclass="demo">hello this is a string</p>

Solution 2:

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

Solution 3:

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;
}
<pclass="demo">hello this is a string</p>

Post a Comment for "Css Styling To Show End Of Single Text String"