0
点赞
收藏
分享

微信扫一扫

html属性选择器

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>


  <style>

/* 属性选择器:

        根据元素上已有的属性标识进行选择

        语法:[属性名='']{}            

        ^ : 以...开始

        $ : 以...结束  

        * : 包含 */


    /* 具有title属性的元素 */

    [title]{

        font-size: 18px;

    }

    /* 以....开始 */

    [href^="http"]{

        color: #008B8B;

    }

    /* 以....结束 */

    [href$="cn"]{

        color:#da0b0b;

    }

    /* href中包含...元素 */

    [href*="i"]{

        color: #808080;

    }

</style>  

</head>

<body>

    <button title="普通按钮">普通按钮</button>

<a href="http://www.baidu.com">百度链接</a>

<a href="www.sina.cn">新浪博客</a>

<a href="http://www.yunhe.cn">云和数据</a>

</body>

</html>

举报

相关推荐

0 条评论