当我在文本框中更改占位符的大小时,它看起来是错误的

时间:2015-04-19 19:54:34

标签: css textbox placeholder

JsFiddle 问题在于占位符,当我将字体大小设置得更高时,看起来不对,检查jsfiddle,文本看起来分成两半。

<input type="text" id="txtSearch" placeholder="Search" />

#txtSearch {

    width:1050px;

    height:35px;

    background-color:#605784;

    border-width:0px;

}

::-webkit-input-placeholder {

    color: White;

    font-family:'Open Sans', sans-serif;

    font-size:15pt;

    position:relative;

    top:-5px;

}

1 个答案:

答案 0 :(得分:0)

checkout this solution from stackoverflow 输入及其占位符必须具有匹配的字体样式

    input,
    ::-webkit-input-placeholder {

    color: White;

    font-family:'Open Sans', sans-serif;

    font-size:15pt;

    position:relative;

    top:-5px;

}