[英]How to use Input placeholder in a right way? Am trying to use transforms to placeholders but it does not work? screenshot is below
Is this what you're looking for? 这是您要找的东西吗? Kind of difficult to tell, as you haven't really explained your question / problem..
很难说,因为您还没有真正解释您的问题。
.quote_form input[type=text]{
font-size: 8px;
transition: all 0.5s linear;
}
.quote_form input[type=text]:focus{
padding-left: -10px; // to space the placeholder text away from the border
padding-top: -5px;
font-size: 10px;
}
Note that : the padding needs to be accounted for when setting your width and height on the input
field :) 请注意 :在
input
字段上设置宽度和高度时,需要考虑填充:)
Generally, you can trigger css transition
applying a pseudo selector , in your case could be :focus
. 通常,您可以使用伪选择器触发CSS
transition
,在您的情况下可以是:focus
。 In this case I use font-size
for inputs
in order to increase the size of the placeholder
. 在这种情况下,我将
font-size
用于inputs
,以增加placeholder
的大小。 Please consider adding your HTML and CSS markup so we can provide you a "specific" solution. 请考虑添加HTML和CSS标记,以便我们为您提供“特定”的解决方案。
An example, click to the input in order to focus: 例如,单击输入以集中显示:
input[type=text]{ font-size: 8px; transition: all 0.5s linear; border:1px solid black; } input[type=text]:focus{ padding-left: -50px; font-size: 16px; }
<input class="quote_form" type="text" name="fname" placeholder="placeholder"><br> <input class="quote_form" type="text" name="lname" placeholder="placeholder">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.