css-五种选择器

<!DOCTYPE html>
<html>
  <head>
    <title>03-css选择器.html</title>
    <meta name="content-type" content="text/html; charset=gbk">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    
    <!-- 
        标签选择器:
                标签名{
                }
                
        id选择器:
                #idname{
                }
                注意:一个id的值只能出现一次。
                
        class选择器:
                .classname{
                }
                注意:class表示一个类,可以出现多次。
                
        伪类选择器:
                选择标签的某种状态,需要配合其他选择器一起使用。
                l:未访问过
                v:访问过
                h:悬浮
                a:激活,点击
        
        组合选择器:
            #one,.two,a{
            }
            统一设置样式
                
     -->
    <style type="text/css">
    
        p{
            color:yello;
            }
            
        #one{
            color:red;
            }
        
        .two{
            color:blue;
            }
            
        a:link{
            color:red;
            }
        a:visited{
            color:black;
            }
        a:hover{
            color:pink;
            }    
        a:active{
            color:yellow;
            }
        
        
    </style>
    
  </head>
  
  <body>
   <p>This is my HTML page. </p><br>
    <p id="one"> This is my HTML page. </p>  <br>
    <p class="two"> This is my HTML page. </p>  <br>
    <a href="E:/mycode/day01-html/CSS/01-结合方式.html"  target="_blank">来吧</a>
    
  </body>
</html>

1、共有五种选择器。

2、合理使用各种选择器。

3、关于伪类选择器,要根据各个标签的特性选择合适的属性。

转载于:https://www.cnblogs.com/almost-mujin/p/5819841.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值