国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

id選擇器

id選擇器的定義與用法:

語法結(jié)構(gòu)一:

##myid{ Rules }

此語法結(jié)構(gòu)能夠選擇id為myid的元素。

語法結(jié)構(gòu)二:

E#myid{ sRules }

此語法結(jié)構(gòu)能夠選擇id為myid的E元素。

實(shí)例程式碼:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://ask.php.cn/" />
<title>php中文網(wǎng)</title>
<style type="text/css">
#mytest{
  color:blue;
}
</style>
</head>
<body>
<div>
  <ul>
    <li id="mytest">php中文網(wǎng)歡迎您</li>
    <li>php中文網(wǎng)</li>
  </ul>
  <p id="mytest">php中文網(wǎng)歡迎您</p>
</div>
</body>
</html>

程式碼能夠把id為mytest元素的文字顏色設(shè)定為藍(lán)色。

特別說明:id在整個(gè)html文檔中應(yīng)該是唯一的,但是下面的文檔中有兩個(gè)元素的id是相同的,但是還是實(shí)現(xiàn)了我們想要的效果,不過在大家實(shí)際操作中要杜絕這種現(xiàn)象。?

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://ask.php.cn/" />
<title>php中文網(wǎng)</title>
<style type="text/css">
li#mytest{
  color:blue;
}
</style>
</head>
<body>
<div>
  <ul>
    <li id="mytest">php中文網(wǎng)歡迎您</li>
    <li>php中文網(wǎng)</li>
  </ul>
  <p>php中文網(wǎng)歡迎您</p>
</div>
</body>
</html>

程式碼能夠把id為mytest的li元素中的文字顏色設(shè)定為藍(lán)色。


繼續(xù)學(xué)習(xí)
||
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://ask.php.cn/" /> <title>php中文網(wǎng)</title> <style type="text/css"> li#mytest{ color:blue; } </style> </head> <body> <div> <ul> <li id="mytest">php中文網(wǎng)歡迎您</li> <li>php中文網(wǎng)</li> </ul> <p>php中文網(wǎng)歡迎您</p> </div> </body> </html>
提交重置程式碼