如何设置占位符文本的颜色和字体样式 [英] How to set the color and font style of placeholder text
本文介绍了如何设置占位符文本的颜色和字体样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将颜色设置为占位符,将字体样式更改为粗体,并增加大小.
I want to set the color to the placeholder, change the font style to bold, and increase the size.
我该如何实现?我应该为占位符赋予样式,还是可以通过其他方法实现?我想设置颜色并更改字体样式,以使其在所有浏览器中都能工作,以在以下结果中选择大小.
How can I achieve this? Should I give style to the placeholder, or is there any other way can I achieve this? I want to set the color and change font style to work in all browsers for select size in the below result.
<!doctype html>
<style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }
.k-dropdown-wrap{
border-width: 5px !important;
border-color: #D8D3D3 !important;
}
}
</style>
<link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.2.607/styles/kendo.common-material.min.css" />
<link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.2.607/styles/kendo.material.min.css" />
<link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.2.607/styles/kendo.default.mobile.min.css" />
<script src="//kendo.cdn.telerik.com/2016.2.607/js/jquery.min.js"></script>
<script src="//kendo.cdn.telerik.com/2016.2.607/js/kendo.all.min.js"></script>
<div id="example" role="application">
<div id="tshirt-view" class="demo-section k-content">
<select id="size" placeholder="Select City..." style="width: 300px;" >
<option />
<option />Newyork
<option />Hyderabad
<option />Bangalore
<option />Kolkata
<option />Delhi
</select>
</div>
<script>
$(document).ready(function() {
// create ComboBox from input HTML element
// create ComboBox from select HTML element
$("#size").kendoComboBox();
var select = $("#size").data("kendoComboBox");
});
</script>
</div></!doctype>
推荐答案
您可以将以下代码用于跨浏览器支持:
对于 Google Chrome :
.element::-webkit-input-placeholder {
color: blue;
font-weight: bold;
}
对于 Mozilla Firefox :
.element::-moz-placeholder {
color: blue;
font-weight: bold;
}
对于 Internet Explorer :
.element:-ms-input-placeholder {
color: blue;
font-weight: bold;
}
对于 Opera :
.element:-o-input-placeholder {
color: blue;
font-weight: bold;
}
这篇关于如何设置占位符文本的颜色和字体样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文