具有节id的CSS类上的If条件


If condition on a CSS class with section id

我正试图在HTML节id代码的帮助下编辑"浏览到"时文本的显示方式。以下是我的代码片段:

<span class="headerqmain"><ul><li><a href="#ID001">Question</a></ul></li></span>
<section id="ID001"></section>
<span class="headerq">Question repeated</span>
<span class="answerswerq">Answer to the question</span>

请注意,有100多个问题,页面底部的答案很长。这意味着,当有人点击问题时,他们会向下倾倒到一个列表中,列表中有相同的问题及其答案。(这是常见问题部分)。但是很难看到森林里的树木。

因此,我的目标是标记被跳转到的点击的问题+答案。也许用颜色或更大的文本大小标记它。有人知道在这种情况下条件是否可以在CSS上使用吗?记住这一切都在同一页上。

跳转到时可以使用标记的示例代码

:target .headerq { /* :target would refer to #ID001 in this case */
    font-size: 1.5em;
    color: blue;
}
:target .answerq {
    color: blue;
}

http://css-tricks.com/on-target/了解有关此技术的更多信息。同时查看http://37signals.com/svn/archives/000558.php用于黄色渐变技术。对这种行为的一个很好的增强