<textarea placeholder=""> 里面的文字水平怎么设置居中呢?

2025-03-06 02:51:49
推荐回答(3个)
回答1:

加个CSS样式就行了,也是自己摸索出来的。


在CSS里面加上这个     

textarea::-webkit-input-placeholder {text-align: center;padding-top:25px}

就是这种效果吧。(垂直用vertical-align:middle;好像不行,求大神指导。。)

回答2:

textarea:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
height: 50px;
line-height: 50px;
}

textarea::-moz-placeholder { /* Mozilla Firefox 19+ */
height: 50px;
line-height: 50px;
}
textarea::-webkit-input-placeholder{
height: 50px;
line-height: 50px;
}
textarea:-ms-input-placeholder{
height: 50px;line-height: 50px
}


回答3:

可以直接在input标签中加上:style="text-align: center;" placeholder=""