input实现文字超出省略号(代码示例)


当前第2页 返回上一页

input实现文字超出省略号功能

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

<style>

    *{

        margin: 0;

        padding: 0;

    }

    .box{

        width: 200px;

        padding: 15px;

        border: 1px solid #f60;

        margin: 50px auto;

    }

    .form-control{

        height: 30px;

        line-height: 30px;

        padding: 5px 10px;

    }

    .text-ellipsis{

        white-space: nowrap;

        text-overflow: ellipsis;

        overflow: hidden;

    }

    h2{

        width: 300px;

        margin: 10px auto;

    }

</style>

 

<h2 class="text-ellipsis">文字超出宽度自动变成省略号</h2>

<div class="box">

    <input type="text" class="form-control text-ellipsis">

</div>

其实,让input实现文字超出自动变省略号也非常简单,还是那三段代码。经测试,目前(2018-11-23)为止,只有最新的Chrome、Firefox两个浏览器支持,移动端未测试!

以上就是input实现文字超出省略号(代码示例)的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

css中字间距怎么调整

css可以干些什么

css怎么设置图片拉伸

介绍几个超炫酷的html5动画演示及源码的图文详解

html5离线应用application cache的代码详解

如何使用css设置框架内文本的垂直位置

css教程

css中内联元素可继承的属性有哪些?

前端常见css的面试题目

外部css样式不生效怎么办

更多相关阅读请进入《ellipsis》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...