Do you have any idea on how to get the placeholder attribute to vertically center in safari? Though when you start typing, the text is perfectly centred.
To center it vertically, I multiplied the height of the element to 7.5% and make it line-height. Show activity on this post. Show activity on this post. Use the line-height property to make the placeholder vertically centered.
Use the ::placeholder pseudo-element to style your placeholder text in an <input> or <textarea> form element. Most modern browsers support this, but for older browsers, vendor prefixes will be required.
-Safari Solution-
I got stuck on this issue for a long time despite using
input::-webkit-input-placeholder { line-height:normal!important; }
It turns out that having a line-height in the immediate input
element was breaking my input::webkit-input-placeholder
line-height.
Solution extended:
I removed the line-height in my input style and it fixed my issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With