仿微信输入框静态
来源:互联网 发布:华为的程序员 编辑:程序博客网 时间:2024/06/14 00:41
最近一个项目要采用微信输入框的样式,想了一下,弄了几个小Demo,如下:
只有下划线的文本框:/n
<input style="border:0;border-bottom:1 solid black;background:;">/n
<input style="border:0;border-bottom:1 solid black;background:;">/n
自动向下廷伸的文本框:/n
<textarea name="content" rows="6" cols="80" onpropertychange="if(this.scrollHeight>80) this.style.posHeight=this.scrollHeight+5">输入几个回车试试</textarea>
<textarea name="content" rows="6" cols="80" onpropertychange="if(this.scrollHeight>80) this.style.posHeight=this.scrollHeight+5">输入几个回车试试</textarea>
自动横向廷伸的输入框:/n
<input type="text" style="huerreson:ex pression(this.width=this.scrollWidth)" value="abcdefghijk">
<input type="text" style="huerreson:ex pression(this.width=this.scrollWidth)" value="abcdefghijk">
但是以上方法做出的效果都不能百分百还原微信的输入框,上网查了一下终于解决了这个问题,直接上代码:
html部分:
<div class="qwe" contenteditable="true"></div>
css部分:
.qwe{
width: 200px;
height: auto;
max-height: 200px;
background-color: #CCCCCC;
overflow-y: scroll;
}
width: 200px;
height: auto;
max-height: 200px;
background-color: #CCCCCC;
overflow-y: scroll;
}
总的来说,只要在block元素上加上 contenteditable="true"这条属性就可以实现效果
0 0
- 仿微信输入框静态
- 静态库动态库输入库
- 输入框输入限制
- 自定义密码输入框PasswordInput 仿微信密码输入框
- 仿微信的文本输入框
- 仿微信支付密码输入框
- Android-自定义实现仿微信输入框输入按钮
- 输入框输入限制 只能输入数字
- 输入框可输入、不可输入控制
- 输入框
- 输入框
- 输入框
- 输入框
- 第十二周项目静态局部变量的程序输入
- 【前端】无后台静态页面实现联想输入Demo
- 输入框输入字符限制
- 输入框输入小写字母
- 输入框只能输入数字
- Java四种权限修饰符(public, default, protected, private)的用法和对比
- hadoop原生版安装部署---3.hdfs
- HibernateSpatial4.3+postgresql的使用
- 一,Launch启动图片,隐藏上面的状态栏
- centos6.5 Building the main Guest Additions module
- 仿微信输入框静态
- Android – Toolbar 上的 Navigation Drawer
- 【数据结构】之 线性表详解
- sapui5不同View之间传参数的方法
- markdown如何打出双下标
- wenzahang
- 移动端html5图片上传方法【更好的兼容安卓IOS和微信】
- 修改studio的字体大小
- 给nginx自定义错误页面