php - 将值放在中心的文本框中

标签 php html css

大家好,我想问问大家,如何让文本框中输入的值居中,而占位符值一如既往地保持在左侧?请帮助我。

当前代码:

<style>
.number { text-align:left; }
</style>

<input type="text" class="number" placeholder=" 1.)" >

最佳答案

像这样使用 css 样式 plcaeholder

::-webkit-input-placeholder {
   text-align:left;
}

:-moz-placeholder { /* Firefox 18- */
   text-align:left;
}

::-moz-placeholder {  /* Firefox 19+ */
   text-align:left; 
}

:-ms-input-placeholder {  
   text-align:left;
} 

Demo

关于php - 将值放在中心的文本框中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21524617/

相关文章:

javascript - 使用 ajax 函数在 codeigniter 中重定向

php变量异常行为

php - 在比较运算符之前放置 bool 值或空值的原因是什么?

html - CSS 边框样式 CSS、HTML 和 PHP

javascript - 用JQuery滚动后显示div,然后再次隐藏

css - 选定的行颜色在 jqgrid 中没有改变黄色

html - 如何覆盖右侧的引导容器?

css - 在 heroku 部署后,引导 css 规则应用于自定义规则?

java - 如何清除 Google Proxy 或 googleusercontent.com 缓存?

html - Windows 7 上的 Internet Explorer 10 不加载嵌入字体