zoukankan      html  css  js  c++  java
  • html结构伪类选择器

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="utf-8">
    		<title></title>
    		child 孩子  向下寻找时,没有找到指定元素,则不会在寻找
    		type  类型  向下寻找时,没有找到指定元素,继续往下寻找,直到找到
    		从(1)开始搜索
    		nth-child(值)   nth-of-type(值) 寻找指定值  n=所有  偶数2,4,6…… 基数:1,3,5……如下,可运行
    		first-of-type  寻找第一个元素   last-of-type 寻找最后一个元素  only-of-type  寻找唯一元素
    		
    		<style>
    /* 			li:nth-child(2n+1){
    				background-color: #FF0000;
    			}
    			li:nth-of-type(2n){
    				background-color: blue;
    			} */
    /* 			li:nth-of-type(2){
    				background-color: aqua;
    			}
    			li:nth-child(5){
    				background-color: chocolate;
    			} */
    			li:first-of-type{
    				background-color: #FF0000;
    			}
    			li:last-child{
    				background-color: #FF0000;
    			}
    			p:only-of-type{
    				color: blue;
    			}
    /* 			div:only-of-type{
    				background-color: #FF0000;
    			} */
    		</style>
    	</head>
    	<body>
    		<ul>
    			<div>aaa</div>
    			<li></li>
    			<li></li>
    			<div>aaa</div>
    			<li></li>
    			<li></li>
    			<li></li>
    			<p>111</p>
    		</ul>
    <!-- 		<ul>
    			<li></li>
    			<li></li>
    			<li></li>
    			<li></li>
    			<li></li>
    			<li></li>
    		</ul> -->
    	</body>
    </html>
    

      

  • 相关阅读:
    OpenStack源码系列---neutron-server
    理解全虚拟、半虚拟以及硬件辅助的虚拟化
    QEMU+GDB调试方法
    SQL Server故障转移集群
    OpenStack源码系列---nova-conductor
    mysql 安装和基本使用
    数据库原理
    linux 计划任务
    linux 进程管理和内存分配

  • 原文地址:https://www.cnblogs.com/wsx123/p/15760178.html
Copyright © 2011-2022 走看看