我想在CSS中选择锚标签。为了在以下html文档中的目的,我做了同样的事情。如何使用CSS类选择第一,第二或第三个html元素中的子元素?
我的html文件是在这里:
</head>
<body>
<div class="first">
<center> <a href="http://www.google.com">The first link </a></center>
</div>
<div class="second">
<center> <a href="http://www.fb.com"> The second link </a></center>
</div>
<div class="third">
<center> <a href="http://www.stackoverflow.com"> The third link </a></center>
</div>
</body>
现在我要选择全部标记。我试过这样:
body a:first-child:hover//The first child
{
font-size:30px;
color:yellow;
}
body a+a:hover //the second child
{
font-size:40px;
color:red;
}
body a+a+a:hover //the third child
{
font-size:50px;
color:#fff;
}
但是我得到错误的结果我该怎么办?
你为什么不使用IDS? – FabioG
Sitenote:不要使用''
@Asenar我正在写我自己的代码:) – jahan