批改状态:合格
老师批语:
常见选择器类型有:
1、标签选择器
2、属性选择器:(常用的id选择器(#id)和类选择器.class)
3、伪类选择器:
状态伪类选择器:
(1)、a标签状态伪类选择器器
:link:a标签初始状态选择器:visited:点击后访问的状态:hover:鼠标悬停时的状态:active:单击时的状态(2)、form表单中input状态选择器(常见状态选择伪类等等)
:disabled:选择禁用状态的input标签:read-only:选择只读状态的input标签:required:选择必选项的input标签:focus:选择选中的input标签4、选择器的优先级
(1)!important > 行内样式(内敛样式)> id选择器 > class选择器、属性选择器(含伪类选择器) > 标签选择器 > 通配符选择器
(2)常见的选择器的权重值(id、class、标签)
1、字体属性:
| 属性 | 属性值 | 作用 |
|---|---|---|
| font-size | 单位:像素px rem、em | 设置字体大小 |
| font-family | 与系统字体一致,可以设多值 | 设置不同字体 |
| font-weight | 100-900数值或者normal、bold、light等 | 设置字体粗度 |
| font-style | normal、italic(斜体)、oblique(认为设置的倾斜提) | 设置字体样式 |
| line-height | 单位px | 设置字体高度 |
1、盒子一般包含以下部分:
2、盒子内外边距的使用方式:
top right bottom left都可以单独设置宽度,值为像素,padding:10px 5px; 第一个值表示上下边宽度,第二个值表示左右边宽度padding:10px 5px 15px; 第一个值表示上下边宽度,第二个值表示左右边宽度,第三个值为底边padding:10px;1、代码:
<!DOCTYPE html><html><head><meta charset="utf-8"><title>CSS选择器和状态伪类</title><style>a:link{text-decoration: none;color:#42B983}a:visited{color:#8B0000;}a:active{background-color: #FF0000;}a:hover{font-size: 40px;}form{display: flex;flex-direction: column;width: 400px;/* text-align: center; */}input:disabled{background-color: lightgreen;}input:read-only{background-color: red;}input:focus{background-color:#DA70D6;}input:required{background-color: #000000;}form{margin:10px 15px;padding: 10px;}body{background: url(image/bg.jpg);background-size: 600px;background-repeat: no-repeat;}</style></head><body><a href="https://www.zhongyequan.com">种业圈</a><form action=""><div><label for="">用户名:</label><input type="text" disabled value="admin"></div><div><label for="">密码:</label><input type="password" name="" id="" readonly value="123456"></div><input type="text"><input type="text" required><button>登陆</button></form></body></html>
2、运行结果图
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号