栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

前端打卡第十二天

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

前端打卡第十二天

1.表单新增

邮箱

网址

数字

滑块控件

颜色

年

月

周

时间

本地时间

电话

required  输入不能为0

maxlength  最大长度

placeholder  未输入时的提示,输入时自动消失

autocomplete  相当于历史记录 属性值="off"/"on"

output  输出标签



    


+ =
 2.属性选择器

语法:选择器[属性="属性值"]{要修改的代码}

一般用在input

div[class^="box1"]  需以box1开始

div[class$="box1"]  需以box1结束

修改单选框样式:

-weblit-appearance:none;        去掉默认样式

input[type="radio"]:checked{background:url(   )}

3.结构伪类选择器
ol li:first-child{color:red;}


ol li:last-child{color:red;}


ol li:nth-child(n){color:red;}


ol li:nth-child(2n){color:red;}


ol li:nth-child(2n-1){color:red;} 


ol li:nth-last-child(n){color:red;}


ol li:first-of-type{color:red;}


ol li:nth-of-type(2n+1){color:red;}


ol li:last-of-type{color:red;}


ol li:empty{background:#ff0000;}


:root{background:#ff0000;}
4.UI状态伪类选择器

主要用于表单

input:disabled{color:"red";}


input:read-only{color:"red";}


outline:none;


input:focus{color:"red";}


input:enabled{ color:"red";}


input:checked{color:"red";}

5.否定伪类选择器

除了某个标签中的某个不改,其余全改

li:not(.box){color:red;}
li:not(:nth-child(2)){color:red;}
6.目标伪类选择器

选中谁给谁添加样式 

使用该选择器来对页面中的某个target元素(该元素的id当做页面中的超链接来使用)指定样式,该样式只在用户点击了页面中的超链接,并且跳转到target元素后起作用

div:target{color:red;}
7.关系选择器 

后代选择器(以空格     分隔)

用于选取某元素的后代元素。

div p
{
  background-color:yellow;
}

子元素选择器(以大于 > 号分隔)

只能选择作为某元素直接/一级子元素的元素

div>p
{
  background-color:yellow;
}

相邻兄弟选择器(以加号 + 分隔)

可选择紧接在另一元素后的元素,且二者有相同父元素

如果需要选择紧接在另一个元素后的元素,而且二者有相同的父元素,可以使用相邻兄弟选择器

div+p
{
  background-color:yellow;
}

普通兄弟选择器(以波浪号 ~ 分隔)

选取所有指定元素之后的相邻兄弟元素 

div~p
{
  background-color:yellow;
}
 8.所有伪类表
选择器示例示例说明
:checkedinput:checked选择所有选中的表单元素
:disabledinput:disabled选择所有禁用的表单元素
:emptyp:empty选择所有没有子元素的p元素
:enabledinput:enabled选择所有启用的表单元素
:first-of-typep:first-of-type选择的每个 p 元素是其父元素的第一个 p 元素
:in-rangeinput:in-range选择元素指定范围内的值
:invalidinput:invalid选择所有无效的元素
:last-childp:last-child选择所有p元素的最后一个子元素
:last-of-typep:last-of-type选择每个p元素是其母元素的最后一个p元素
:not(selector):not(p)选择所有p以外的元素
:nth-child(n)p:nth-child(2)选择所有 p 元素的父元素的第二个子元素
:nth-last-child(n)p:nth-last-child(2)选择所有p元素倒数的第二个子元素
:nth-last-of-type(n)p:nth-last-of-type(2)选择所有p元素倒数的第二个为p的子元素
:nth-of-type(n)p:nth-of-type(2)选择所有p元素第二个为p的子元素
:only-of-typep:only-of-type选择所有仅有一个子元素为p的元素
:only-childp:only-child选择所有仅有一个子元素的p元素
:optionalinput:optional选择没有"required"的元素属性
:out-of-rangeinput:out-of-range选择指定范围以外的值的元素属性
:read-onlyinput:read-only选择只读属性的元素属性
:read-writeinput:read-write选择没有只读属性的元素属性
:requiredinput:required选择有"required"属性指定的元素属性
:rootroot选择文档的根元素
:target#news:target选择当前活动#news元素(点击URL包含锚的名字)
:validinput:valid选择所有有效值的属性
:linka:link选择所有未访问链接
:visiteda:visited选择所有访问过的链接
:activea:active选择正在活动链接
:hovera:hover把鼠标放在链接上的状态
:focusinput:focus选择元素输入后具有焦点
:first-letterp:first-letter选择每个

元素的第一个字母

:first-linep:first-line选择每个

元素的第一行

:first-childp:first-child选择器匹配属于任意元素的第一个子元素的

元素

:beforep:before在每个

元素之前插入内容

:afterp:after在每个

元素之后插入内容

:lang(language)p:lang(it)为

元素的lang属性选择一个开始值

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/993351.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号