支援CSS3 以上
用法::required
說明:
用在input輸入框,配合required來使用。
當input 有required屬性則套用樣式。
css定義:
input:required {
border: 2px solid red;
}
注意事項:
required : 所需的 、必要的 之意
程式:
<!DOCTYPE html>
<html>
<head>
<title>css3 Selector required 套用樣式</title>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<style type="text/css">
input:required {
border: 2px solid red;
}
</style>
</head>
<body>
<form action="">
name: <input type="text" value="levin" required><br>
數量1: <input type="number" min="5" max="10" value="1"><br>
E-mail<input type="email" value="myEmail"><br>
</form>
</body>
</html>
圖1:
測試結束~
如果還不了解可參考:w3schools CSS Selector Reference
感謝~
- 首頁
- JAVA 目錄
- JAVA WEB 目錄
- JAVA 其他未分類 目錄
- Grails目錄
- jQuery 目錄
- Apache 目錄
- JavaScript 目錄
- Spring + Hibernate 目錄
- Hibernate 目錄
- Linux 目錄
- 程式開發工具目錄
- MySQL 目錄
- PHP目錄
- C/C++ 目錄
- Google App Engine 目錄
- HTML5/CSS3
- 程式開發基本資訊
- Android
- Oracle 目錄
- Struts 目錄