<p>some text</p>怎么不变红色

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html>

<head>

<style type="text/css">

p:first-child {

  color: red;

  } 

li:first-child {text-transform:uppercase;}

</style>

</head>


<body>


<ul>

<li>Intert Key</li>

<li>Turn key <strong>clockwise</strong></li>

<li>Push accelerator</li>

</ul>

<p>some text</p>

</body>

</html>


大黑虎
浏览 1762回答 3
3回答

echo_kinchao

这个标识的是p里面的孩子

大黑虎

“:first-child”指选择任何元素的第一个子元素,ele:first-child{color:red}是指ele是某个父元素的第一个元素,而父元素是谁不重要,重要的是ele是第一个子元素
打开App,查看更多内容
随时随地看视频慕课网APP