How to set placeholder value using CSS?

后端 未结 9 1306
天涯浪人
天涯浪人 2020-12-16 09:00

I want to set the placeholder value of an input box using only css and not JavaScript or jQuery. How can I do this?

9条回答
  •  悲&欢浪女
    2020-12-16 09:38

    AFAIK, you can't do it with CSS alone. CSS has content rule but even that can be used to insert content before or after an element using pseudo selectors. You need to resort to javascript for that OR use placeholder attribute if you are using HTML5 as pointed out by @Blender.

提交回复
热议问题