-3
身份证可以在CSS中的父母?例如:父母和孩子在Css
<div id="link">
</a href="www.example.com"></a>
</div>
CSS:
link > a{
/* style goes here*/
}
是否有可能做到这一点?
身份证可以在CSS中的父母?例如:父母和孩子在Css
<div id="link">
</a href="www.example.com"></a>
</div>
CSS:
link > a{
/* style goes here*/
}
是否有可能做到这一点?
你的HTML不正确。你的开头a
标签实际上是一个结束标签。而你的a
元素没有内容点击。
除此之外,只需在任何有效的选择器上使用"child" operator:parent > child
。
只要它们有效,选择器parent
和child
是(元素,id,类,伪类,伪元素,分层等)无关紧要。
#parent {
height:100px;
background-color:rgba(0,0,255,.2);
padding:20px;
}
/* This will select all <a> elements that are children of #parent */
#parent > a {
background-color:yellow;
box-shadow:2px 2px 2px rgba(75,75,0,.8);
padding:5px;
margin:2px;
border-radius:20px;
text-decoration:none;
display:inline-block;
}
/* This will affect any <a> that is being interactied with */
#parent > a:active {
background-color:yellow;
box-shadow:-2px -2px 2px rgba(100,100,100,.5);
}
<div id="parent">
<a href="http://www.example.com">Click me</a>
<a href="http://www.example.com">Click me</a>
<a href="http://www.example.com">Click me</a>
<a href="http://www.example.com">Click me</a>
</div>
是的,这是可能的。
#link >a{
color:red;
}
#link >a{
color:red;
}
<div id="link"><a href="www.example.com">LINK</a></div>
'#LINK>了'可能 – AdhershMNair
你的HTML不正确。你打开'a'标签实际上是一个结束标签。 –
你试过了吗? – j08691