twitter-bootstrap 如何更改引导程序和引导程序材料设计的占位符字体大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39361216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 00:16:37  来源:igfitidea点击:

How do I change placeholder font size for bootstrap and bootstrap material design?

csstwitter-bootstraptwitter-bootstrap-3

提问by stackjlei

My jsfiddle herehas links to bootstrap and bootstrap material design. I want to make the font for the input placeholder smaller but it just doesn't budget, even with input-placeholder for moz or webkit. Any suggestions would be greatly appreciated.

我的jsfiddle这里有链接,引导和引导材料设计。我想让输入占位符的字体更小,但它只是没有预算,即使使用 moz 或 webkit 的输入占位符也是如此。任何建议将不胜感激。

html

html

<form class="form form-group has-info col-md-4">
      <input class="search-input form-control" placeholder=" . . . enter pokemon name" type="text">
      <button type="submit" class="btn btn-info btn-raised " name="button">Search!</button>
 </form>

css

css

::-webkit-input-placeholder {
   font-size: 25px;
}

:-moz-placeholder { /* Firefox 18- */
      font-size: 25px;
}

::-moz-placeholder {  /* Firefox 19+ */
      font-size: 25px;
}

:-ms-input-placeholder {
      font-size: 25px;
}

回答by Hitesh Misro

Add !importantto override the styles

添加!important以覆盖样式

::-webkit-input-placeholder {
   font-size: 25px;
}

:-moz-placeholder { /* Firefox 18- */
      font-size: 25px;
}

::-moz-placeholder {  /* Firefox 19+ */
      font-size: 25px;
}

/* Overriding styles */

::-webkit-input-placeholder {
   font-size: 13px!important;
}

:-moz-placeholder { /* Firefox 18- */
      font-size: 13px!important;
}
::-moz-placeholder {  /* Firefox 19+ */
      font-size: 13px!important;
}
<input type="text" placeholder="Example..">