liguofeng29’s blog

個人勉強用ブログだっす。

CSS3.0のセレクタ - idとclassセレクタ

<!DOCTYPE html>
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=SJIS" />
   <title>IDとclassセレクタ</title>
   <style type="text/css">
    #yy {
        background-color:#82FF63;
    }
    
    p#xx {
        border:2px dotted black;
        background-color:#888;
        height:40px;
    }
    
    .myclass {
        background-color:#7FD5F8;
    }
    p.myclass {
        border:2px dotted black;
        height:40px;
    }
    
    </style>
</head>
<body>
<div id="yy">idがyy要素</div>
<p id="xx">idがxxのp要素</div>


<div class="myclass">classがmyclass要素</div>
<p class="myclass">classがmyclassのp要素</p>

</body>
</html>

f:id:liguofeng29:20160126223859p:plain