如何在html输入字段中使用文本溢出省略号? [英] How to use text-overflow ellipsis in an html input field?

查看:167
本文介绍了如何在html输入字段中使用文本溢出省略号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页有输入字段,我已应用以下css:

My web page has input fields to which I have applied the following css :

.ellip {
    white-space: nowrap;
    width: 200px;
    overflow: hidden;
    -o-text-overflow: ellipsis;
    -ms-text-overflow: ellipsis;
    text-overflow: ellipsis;
}

但这似乎没有任何效果。
我在这里缺少一些明显的东西,或者是不可能在使用CSS的输入字段中使用省略号。

But this doesn't seem to have any effect. Am I missing something obvious here or is it not possible to have an ellipsis in an input field using CSS only ?

推荐答案

p>字段是具有自己的规则的元素。

A field is an element with its own rules. The input field is implemented in the way that if the text gets longer than the field, the text gets just unseen.

这样做的原因是,如果你使用该字段,那么输入字段的实现方式是,如果文本的长度超过字段,在一种形式,它可以使用文本溢出省略号,那么它只会传输截断的内容,什么不是想要的效果。

The reason for this is, if you use the field in a form and it would be possible to use text-overflow ellipsis, then it would only transmit the truncated content, what is not the wanted effect.

这篇关于如何在html输入字段中使用文本溢出省略号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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