首页 > 技术文章 > 关于textarea标签自己遇到的问题

lin-white 2019-04-28 09:53 原文

效果描述:
固定文本框的宽高,让文本框不被拖拽,让提示内容的文字垂直居中

html:

<div>
  <label>活动详情</label>
  <textarea class="textarea" placeholder="富文本编辑器" ></textarea>
</div>
css:
.textarea{
width: 41%;
height: 198px;
resize: none;//禁止拖拽文本框
}
//使提示内容垂直居中
/* 使用webkit内核的浏览器 */
.textarea::-webkit-input-placeholder{
height: 200px;
line-height: 200px;
text-align: center;
}
/* Firefox版本4-18 */
.textarea:-moz-placeholder{
height: 200px;
line-height: 200px;
text-align: center;
}
/* Firefox版本19+ */
.textarea::-moz-placeholder{
height:200px;
line-height:200px;
text-align: center;
}
.textarea:-ms-input-placeholder{
height: 200px;
line-height: 200px;
text-align: center;
}
 
 

推荐阅读