作者:玩玩r28g | 来源:互联网 | 2023-09-06 15:35
Ihavereadacoupleofarticlesaboutstylingtheplaceholderofaninputfieldusing::-webkit-inp
I have read a couple of articles about styling the placeholder of an input field using ::-webkit-input-placeholder
in HTML5. It works perfectly, except for one thing.
我已经阅读了几篇关于在HTML5中使用:: - webkit-input-placeholder设置输入字段占位符的文章。它完美无缺,除了一件事。
If I try to increase the font-size to a value higher than 16px, the text gets "cut" at the bottom. This happens regardless of height and padding of the input itself. Does anyone know a way of avoiding this problem, either using pure CSS or Javascript?
如果我尝试将font-size增加到高于16px的值,则文本会在底部“剪切”。无论输入本身的高度和填充如何,都会发生这种情况。有没有人知道一种避免这个问题的方法,使用纯CSS还是Javascript?
I have added a screenshot of two inputfields where the placeholders have an font-size of 20px
我添加了两个输入字段的屏幕截图,其中占位符的字体大小为20px
Jsfiddle: https://jsfiddle.net/bvwdg86x/
Jsfiddle:https://jsfiddle.net/bvwdg86x/
2 个解决方案