本文介绍了在CSS中选择特定元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
很抱歉,非常通用的帖子标题。但我在这之后是这样的:
Sorry about the very generic post title. But what I'm after here is this:
<div id="my-div"> <span> <a href="#">link 1</a> <a href="#">link 2</a> </span> <a href="#">link 3</a> </div>如何在CSS中选择link 3没有编辑该Html有在所有。这是提交的html,我需要选择链接3而不选择链接1和2.
How would I select 'link 3' in CSS? Without editing that Html there at all. This is the html that presented with and I need to select link 3 without selecting link 1 and 2.
任何想法?
推荐答案您发布的字面意思是查找 div div ,并且是其父级的直接子级。
What you posted literally means "Find any a that are inside of div#my-div and are the direct child of their parent."
使用
div#my-div > a使用> 更改说明to:找到 div#my-div 的直接后代的任何 a
Using the > changes the description to: "Find any a that are the direct descendents of div#my-div" which is what you want.
更多推荐
在CSS中选择特定元素
发布评论