CSS 平级和儿子级样式写法示例
建站知识 2021-07-03 08:15www.168986.cn长沙网站建设
input:checked+ol:这个是讲当inoput 拥有了checked后它平级的OL拥有的样式。
input:checked+ol>li:中的大于是指当inoput 拥有了checked后它平级的OL狼蚁网站SEO优化儿子辈的li的样式,孙子辈的不继承。
Html代码
<!DOCTYPE html>
<html lang="zh-">
<head>
<meta charset="utf-8" />
<title>用户界面(UI)元素状态伪类选择符 E:checked_CSS参考手册_web前端开发参考手册系列</title>
<style type="text/css">
input[type=radio]:checked + span{background:blue;}
input[type=radio]:checked + span:after{content:" 我被选中了";}
input[type=checkbox]:checked + span{background:#f00;}
input[type=checkbox]:checked + span:before{content:" 我被选中了";}
div.classFather > div.classSon div.classSon{
background-color: lightgray;
line-height: 40px;
}
div.classFather > div.classSon > div.classSonS > div.classSonC {
background-color: lightgray;
line-height: 40px;
}
</style>
</head>
<body>
<form method="post" action="#">
<fieldset>
<legend>选中狼蚁网站SEO优化的项试试</legend>
<ul>
<li><label><input type="radio" name="colour-group" value="0" /><span>蓝色</span></label></li>
<li><label><input type="radio" name="colour-group" value="1" /><span>红色</span></label></li>
<li><label><input type="radio" name="colour-group" value="2" /><span>黑色</span></label></li>
</ul>
</fieldset>
<fieldset>
<legend>选中狼蚁网站SEO优化的项试试</legend>
<ul>
<li><label><input type="checkbox" name="colour-group2" value="0" /><span>蓝色</span></label></li>
<li><label><input type="checkbox" name="colour-group2" value="1" /><span>红色</span></label></li>
<li><label><input type="checkbox" name="colour-group2" value="2" /><span>黑色</span></label></li>
</ul>
</fieldset>
<fieldset>
<legend>子节点样式</legend>
<div class="classFather">
<div class="classSon">孩子
<div class="classSon">孙子
<div class="classSon">重孙子</div>
</div>
</div>
<div class="classSon">孩子
<div class="classSonS">孙子
<div class="classSonC">重孙子</div>
</div>
</div>
</div>
</fieldset>
</form>
</body>
</html>
input:checked+ol>li:中的大于是指当inoput 拥有了checked后它平级的OL狼蚁网站SEO优化儿子辈的li的样式,孙子辈的不继承。
Html代码
复制代码
代码如下:<!DOCTYPE html>
<html lang="zh-">
<head>
<meta charset="utf-8" />
<title>用户界面(UI)元素状态伪类选择符 E:checked_CSS参考手册_web前端开发参考手册系列</title>
<style type="text/css">
input[type=radio]:checked + span{background:blue;}
input[type=radio]:checked + span:after{content:" 我被选中了";}
input[type=checkbox]:checked + span{background:#f00;}
input[type=checkbox]:checked + span:before{content:" 我被选中了";}
div.classFather > div.classSon div.classSon{
background-color: lightgray;
line-height: 40px;
}
div.classFather > div.classSon > div.classSonS > div.classSonC {
background-color: lightgray;
line-height: 40px;
}
</style>
</head>
<body>
<form method="post" action="#">
<fieldset>
<legend>选中狼蚁网站SEO优化的项试试</legend>
<ul>
<li><label><input type="radio" name="colour-group" value="0" /><span>蓝色</span></label></li>
<li><label><input type="radio" name="colour-group" value="1" /><span>红色</span></label></li>
<li><label><input type="radio" name="colour-group" value="2" /><span>黑色</span></label></li>
</ul>
</fieldset>
<fieldset>
<legend>选中狼蚁网站SEO优化的项试试</legend>
<ul>
<li><label><input type="checkbox" name="colour-group2" value="0" /><span>蓝色</span></label></li>
<li><label><input type="checkbox" name="colour-group2" value="1" /><span>红色</span></label></li>
<li><label><input type="checkbox" name="colour-group2" value="2" /><span>黑色</span></label></li>
</ul>
</fieldset>
<fieldset>
<legend>子节点样式</legend>
<div class="classFather">
<div class="classSon">孩子
<div class="classSon">孙子
<div class="classSon">重孙子</div>
</div>
</div>
<div class="classSon">孩子
<div class="classSonS">孙子
<div class="classSonC">重孙子</div>
</div>
</div>
</div>
</fieldset>
</form>
</body>
</html>
上一篇:纯css实现的下拉菜单只有边框底纹用到图片
下一篇:css基础教程之CSS基础语法
长沙网站设计
- 如何进行东阳SEO关键词优化?
- 边坝哪有关键词排名优化:提升你的网站流量与
- 安国百度优化服务:提升您的在线可见性
- 阜康新手做SEO怎么做
- 山西seo网站排名关键词优化:提升您网站曝光率
- 临沂seo网站排名关键词优化:提高你的网站可见
- 广西SEO网站推广怎样付费比较合理
- 双辽SEO网站推广:提升你的网站可见性与流量
- 辽宁企业网站优化购买方式有哪些
- 提升宝清百度SEO排名的实用技巧与策略
- 静宁百度SEO排名:提升您网站曝光率的关键策略
- 彭州百度SEO排名的提升策略和实施指南
- 广南百度关键词SEO:提升网站排名的关键策略
- 辽宁关键词优化怎么做论坛营销
- 吉林百度seo排名如何做到让用户满意
- 内黄百度优化服务:提升在线可见性的关键