CSS样式显示单个文本字符串的结尾 [英] CSS styling to show end of single text string

查看:199
本文介绍了CSS样式显示单个文本字符串的结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在学习CSS:这似乎是一个简单的任务,但是我花了一些时间研究并且无法使它起作用:

I'm just learning CSS: this seems like a simple task but I've spent a while researching and can't get it to work:

说我有一个很长的文本字符串-如何使所有文本以一定的宽度显示在一行上,但将显示的内容限制在字符串的末尾?

Say I have a long text string -- how do you 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?

.demo {
    border: 1px solid red;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
}

<p class="demo">hello this is a string</p>

例如,在这里它显示字符串的开头(并切断结尾),但我需要它来显示结尾(并切断开头).

For example, here it shows the beginning of the string (and cuts off the end), but I need it to show the end (and cut off the beginning).

任何帮助将不胜感激;我可能只缺一行.非常感谢!

Any help would be truly appreciated; I may just be missing one line. Thank you so much!

推荐答案

.demo {
    border: 1px solid red;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    direction: rtl;
}

<p class="demo">hello this is a string</p>

这篇关于CSS样式显示单个文本字符串的结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆