HTML5 Placeholder Styling with CSS
来源:互联网 发布:轮扣式脚手架计算软件 编辑:程序博客网 时间:2024/05/02 14:44
http://davidwalsh.name/html5-placeholder-css
4/25/2011: This attribute is not styleable as of Opera 11. Internet Explorer 10 will introduceplaceholder
support.
Last week I showed you how you could style selected text with CSS. I've searched for more interesting CSS style properties and found another: INPUT
placeholder styling. Let me show you how to style placeholder text within INPUT
elements with some unique CSS code.
The CSS
Firefox employs a different pattern than Safari and Chrome. Each property name is self-explanatory though:
/* all */::-webkit-input-placeholder { color:#f00; }::-moz-placeholder { color:#f00; } /* firefox 19+ */:-ms-input-placeholder { color:#f00; } /* ie */input:-moz-placeholder { color:#f00; }/* individual: webkit */#field2::-webkit-input-placeholder { color:#00f; }#field3::-webkit-input-placeholder { color:#090; background:lightgreen; text-transform:uppercase; }#field4::-webkit-input-placeholder { font-style:italic; text-decoration:overline; letter-spacing:3px; color:#999; }/* individual: mozilla */#field2::-moz-placeholder { color:#00f; }#field3::-moz-placeholder { color:#090; background:lightgreen; text-transform:uppercase; }#field4::-moz-placeholder { font-style:italic; text-decoration:overline; letter-spacing:3px; color:#999; }
You will only want to employ the most basic of styles to the placeholder. Color, font-style, and font-variant are probably the styles you will want to employ. Go too far with your placeholder styling and you may create the animated GIF of input styles. Note that Mozilla Firefox doesn't support placeholder styling until version 4.
Styling elements with the placeholder attribute is something you don't need to do but could be just another one of those small details that sets your website apart from other websites. Hopefully IE9 and Opera soon follow suit in allowing styling of placeholder text within INPUT elements...or expose their API for doing so!
- HTML5 Placeholder Styling with CSS
- CSS修改HTML5 placeholder颜色
- 使用CSS修改HTML5 input placeholder颜色
- 使用CSS修改HTML5 input placeholder颜色
- 使用CSS修改HTML5 input placeholder颜色
- HTML5 Placeholder
- HTML5中input背景提示文字(placeholder)的CSS美化
- HTML5中input背景提示文字(placeholder)的CSS美化
- HTML5中input背景提示文字(placeholder)的CSS美化
- HTML5中input背景提示文字(placeholder)的CSS美化
- Radio button with Jquery Mobile apply styling!!
- 21 Useful Scrollbar CSS/JavaScript Styling Tutorials
- HTML5 placeholder JS模拟
- HTML5 的 PLACEHOLDER 属性
- html5新属性 placeholder
- js模仿html5 placeholder
- HTML5----placeholder属性
- placeholder 是HTML5
- linux c 利用指针将函数传出参数的值
- 程序员常去的14个顶级开发社区
- Hadoop YARN新特性—label based scheduling
- LeetCode 题解(118): Contains Duplicate III
- The CSS3 Placeholder Pseudo-element
- HTML5 Placeholder Styling with CSS
- POJ 2418 解题报告
- UVa 10188 - Automated Judge Script
- 从零搭建LNMP环境(一) - 编译源码安装PHP
- 从零搭建LNMP环境(二) - 集成Nginx与PHP
- [nio]dawn的基本概念
- vs2013 Matlab引擎 丢失libeng.dll
- 从零搭建LNMP环境(三) - 安装MySQL数据库服务器
- php5.5新特性