欢迎光临
我们一直在努力

CSS属性选择器指的是什么

小编给大家分享一下CSS属性选择器指的是什么,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

CSS属性选择器

<meta charset="UTF-8">

<title>Title</title>

<style>

    .demo a{

        float: left;

        display: block;

        height: 50px;

        width: 50px;

        text-align: center;

        border-radius: 10px;

        background-color: aqua;

        color: blue;

        text-decoration: none;

        margin-right: 10px;

        font: bold 20px/50px Arial;

    }

    /*选中a标签里面带有id属性的元素   语法 : a[属性名或者属性名=属性值]{}

    这里面的 = 表示绝对等于

    *=  包含这个元素

    ^=  表示以什么开头

    $=  表示以什么结尾

    */

    /*a[id]{

        background-color: yellow;

    }*/

   /* a[id=first]{

        background-color: #e51010;

    }*/

    /*选中class中含有links的元素*/

    /*a[class*="links"]{

        background-color: yellow;

    }*/

    /*选中href中以http开头的元素*/

    /*a[href^=http]{

        background-color: yellow;

    }*/

    /*选中href中以pdf结尾的元素*/

    a[href$=pdf]{

        background-color: yellow;

    }

</style>

<p class="demo">

    <a href="https://www.baidu.com" class="links item first" id="first">1</a>

    <a href="https:" class="links item first" target="_blank" title="test">2</a>

    <a href="image/123.html" class="links item">3</a>

    <a href="image/123.png" class="links item">4</a>

    <a href="image/123.jpg" class="links item">5</a>

    <a href="abc" class="links item">6</a>

    <a href="abc/a.pdf" class="links item">7</a>

    <a href="/ad.pdf" class="links item">8</a>

    <a href="abd.doc" class="links item">9</a>

    <a href="djw.doc" class="links item last">10</a>

</p>

以上是“CSS属性选择器指的是什么”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注云搜网行业资讯频道!

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。