选择具有相同类名的mutliple div的第一个div

时间:2016-08-22 11:05:55

标签: css

任何人都知道如何选择具有相同类名的多重div的第一个div

str[0]

如何在CSS中选择第一个img?

2 个答案:

答案 0 :(得分:0)

您可以使用first-child伪类

.abc:nth-of-type(1)
{
  height:100px;
  width:100px;
  background:red
  }
<div class="abc"><a><img src=""></a></div>
<div class="abc"><a><img src=""></a></div>

答案 1 :(得分:0)

div:nth-of-type(1)  {
   color: white;[enter link description here][1]
 }

<强> demo

相关问题