設定input 中placeholder的樣式
阿新 • • 發佈:2018-12-12
一、效果 二、程式碼
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> ::-webkit-input-placeholder { /* Chrome/Opera/Safari */ color: red; } ::-moz-placeholder { /* Firefox 19+ */ color: red; } :-ms-input-placeholder { /* IE 10+ */ color: red; } :-moz-placeholder { /* Firefox 18- */ color: red; } </style> </head> <body> 名字:<input type="" name="" placeholder="我是一個測試"> </body> </html>
三、HTML input placeholder支援的屬性
- font properties
- color
- background properties
- word-spacing
- letter-spacing
- text-decoration
- vertical-align
- text-transform
- line-height
- text-indent
- opacity
eg1、 效果 程式碼:
input::-webkit-input-placeholder {
padding-left:30px;
opacity:0.5;
}
剩下的大家自己去測哈~