[英]Specific elements for CSS :target?
I'm having a problem with nesting :target pseudoclasses. 我在嵌套:target伪类时遇到问题。 I currently have a section with an anchor inside.
我目前有一个内部带有锚点的部分。
It's working correctly right now, when I click the anchor that links to #Current, it'll widen the area and display whatever is in #Current. 现在,它可以正常工作,当我单击链接到#Current的锚点时,它将扩大区域并显示#Current中的内容。
However, inside my #Current, I have another anchor that links to #Taask. 但是,在#Current内部,我还有另一个链接到#Taask的锚点。 When this happens, I don't want to set the width again, I just want to set display.
发生这种情况时,我不想再次设置宽度,只想设置显示。
Here is my html and css code: 这是我的HTML和CSS代码:
<section id="Current">
<a href="#Current">Current Work</a>
<div class="accordion_content">
<ul id="current_projects">
<li><a href="#Taask">Taask</a></li>
</ul>
<div id="Taask" class="project_info">
Some Info
</div>
</div>
</section>
#Current:target {
width: 780px;
}
This CSS :target declaration will work for ALL anchors inside my sections. 这个CSS:target声明将适用于我的部分中的所有锚。 Anyway to specify something like
无论如何要指定类似
#Current .firstclass:target {
width: 780px;
}
and 和
#Current .secondclass:target {
display: block;
}
Any suggestions? 有什么建议么?
For reference: www.redsquiggli.es 供参考:www.redsquiggli.es
Basically trying to get the items inside my Current tab to do a different action than the accordion tabs when clicked. 基本上是尝试使“当前”选项卡中的项目与单击时的“手风琴”选项卡不同。
From imakewebthings on Forrst: http://forr.st/~B9d 从Forrst上的imakewebthings: http ://forr.st/~B9d
You cannot nest target selectors. 您不能嵌套目标选择器。 Documents can only have one fragment identifier (thing after the #) so there can only be one target.
文档只能有一个片段标识符(在#后面),因此只能有一个目标。 A parent selector would work to keep the parent tab at the desired width, if such a selector existed, but it does not for good reason.
如果存在这样的选择器,则可以使用父选择器将父选项卡保持在所需的宽度,但是这样做并不是出于充分的理由。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.