美文网首页
如何让textarea placeholder 文字垂直居中?

如何让textarea placeholder 文字垂直居中?

作者: 小小的开发人员 | 来源:发表于2019-04-02 20:12 被阅读0次

当textarea标签为多行是,placeholder的内容,往往会在文字的开始位置,显得很难看,下列的方法可以让textarea的placeholder 文字垂直居中。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    #textArea {
      color: white;
      height: 50px;
    }
    #textArea::-webkit-input-placeholder{
      height: 50px;line-height: 50px
    }    /* 使用webkit内核的浏览器 */
    #textArea:-moz-placeholder{
      height: 50px;line-height: 50px
    }                  /* Firefox版本4-18 */
    #textArea::-moz-placeholder{
      height: 50px;line-height: 50px
    }                  /* Firefox版本19+ */
    #textArea:-ms-input-placeholder{
      height: 50px;line-height: 50px
    }
  </style>
</head>
<body>
  <textarea id="textArea" name="" placeholder="请输入"></textarea>
</body>
</html>

相关文章

网友评论

      本文标题:如何让textarea placeholder 文字垂直居中?

      本文链接:https://www.haomeiwen.com/subject/iaenbqtx.html