html中input提示文字樣式修改

在不少網站上咱們都看到input輸入框顯示提示文字,讓咱們一塊兒來看看若是在input輸入框中顯示提示文字。咱們只須要在<input>標籤裏添加:placeholder="提示文字便可",那麼若是要修改提示文字的樣式呢?能夠這樣設置css樣式:css

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>input輸入框提示文字</title>
<style>
/*修改提示文字的顏色*/ input::-webkit-input-placeholder { /* WebKit browsers */ color: red; 
} input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: red; 
} input::-moz-placeholder { /* Mozilla Firefox 19+ */ color: red; 
} input:-ms-input-placeholder { /* Internet Explorer 10+ */ color: red; 
}
</style>
</head>
<body>
<input type="text" placeholder="請輸入用戶名" />
</body>
</html>

修改後提示文字樣式以下:html

相關文章
相關標籤/搜索