温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

CSS属性选择器指的是什么

发布时间:2022-03-03 11:46:40 来源:亿速云 阅读:143 作者:小新 栏目:web开发

小编给大家分享一下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属性选择器指的是什么”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

css
AI