cssセレクタ-プロパティセレクタ

10933 ワード

DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>title>
    <style>
        div{
            width: 300px;
            height: 50px;
            border: 1px solid #000;
            margin:20px auto;
            text-align: center;
        }

        /*div{*/
            /*background-color: red;*/
        /*}*/
        /*    []     */

        /*div[class]{*/
            /*background-color: red;*/
        /*}*/
        /* div  class  ,  box1*/
        /*div[class="box1"]{*/
            /*background-color: pink;*/
        /*}*/
        /* div  class  ,  aa 

        */

        /*div[class^="aa"]{*/
            /*background-color: green;*/
        /*}*/

        /* div  class  ,  aa */

        /*div[class$="aa"]{*/
            /*background-color: yellow;*/
        /*}*/

        /* div  class  , aa*/
        div[class*="aa"]{
            background-color: #daa520;
        }
    style>
head>
<body>
    <div class="box1">1div>
    <div class="aabox2">2div>
    <div class="bbbox3">3div>
    <div class="box4aa">4div>
    <div class="box5bb">5div>
    <div class="aabox6bb">6div>
    <div class="bbbox7aa">7div>
    <div>8div>
body>
html>