IDセレクタ(ID selector)は、要素の型とIDでスタイルの適用領域を指定するセレクタです。
E#myid
E は要素の型、myid は要素のIDを意味します。
次の例はcautionクラスのspan要素のテキストを赤で表示します。
body {color:black;} span#caution {color:red;}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 5 Transitional//EN"> <html lang="ja-JP"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>IDセレクタの使用例</title> <meta name="description" content="CSSのセレクタの使用例です" /> <meta http-equiv="Content-Style-type" content="text/css"> <link rel="stylesheet" href="id_selector_sample.css" type="text/css"> </head> <body> sss <span id=std>span std</span> <span id=caution>span caution</span> </body> </html>