CSS-表单伪类选择器
2017-10-26 14:21
585 查看
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表单伪类选择器</title>
<style>
form *:focus{
/*background-color: pink;*/
}
form *:valid{
/*background-color: green;*/
}
form *:invalid{
/*background-color: red;*/
}
form *:required{
background-color: blue;
}
form *:optional{
background-color: yellow;
}
form *:default{
outline: 1px solid red;
}
form *:checked{
outline: 1px solid blue;
}
</style>
</head>
<body>
<form action="">
<input type="text">
<input type="text" required>
<br>
<input type="tel" required pattern="\d{4}">
<input type="radio" checked name="gender">
<input type="radio" name="gender">
<input type="radio" name="gender">
<input type="radio" name="gender">
</form>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>表单伪类选择器</title>
<style>
form *:focus{
/*background-color: pink;*/
}
form *:valid{
/*background-color: green;*/
}
form *:invalid{
/*background-color: red;*/
}
form *:required{
background-color: blue;
}
form *:optional{
background-color: yellow;
}
form *:default{
outline: 1px solid red;
}
form *:checked{
outline: 1px solid blue;
}
</style>
</head>
<body>
<form action="">
<input type="text">
<input type="text" required>
<br>
<input type="tel" required pattern="\d{4}">
<input type="radio" checked name="gender">
<input type="radio" name="gender">
<input type="radio" name="gender">
<input type="radio" name="gender">
</form>
</body>
</html>
相关文章推荐
- CSS中一些利用伪类、伪元素和相邻元素选择器的技巧实现评论点赞
- css伪类选择器,:link、:visited、:focus、:hover、:active、:first-child
- 关于CSS伪类选择器
- css3伪类选择器--动态伪类选择器
- css实现面包屑导航与冒泡框(border属性与伪类选择器)
- CSS伪类 选择器
- CSS 3 UI元素状态伪类选择器
- Css3之高级-1 Css复杂选择器(兄弟选择器 、属性选择器、伪类选择器、伪元素选择器)
- 谈谈一些有趣的CSS题目(十)-- 结构性伪类选择器
- Css3伪类选择器中的动态伪类
- css之伪类选择器:before :after(::before ::after)
- CSS中的选择器之html选择器和伪类选择器
- css伪类选择器详细解析及案例使用-----伪类选择器(1)
- CSS链接四种状态注意顺序、UI伪类选择器的顺序
- CSS 选择器——(标记、包含关系、类、id、分组、伪类及伪对象选择器)
- CSS 目标伪类选择器
- css 伪类选择器相关
- CSS 语言伪类选择器
- CSS-伪类选择器
- css之框模型(盒子模型)、默认样式初始化、选择器和伪类