- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在创建一个“常见问题解答”页面,该页面顶部(链接)有一个问题列表,答案显示在下面。
点击每个问题会显示相应的答案(使用显示/隐藏 div)。我的问题是:有没有办法让点击的问题/链接加粗?并使其保持粗体直到单击另一个问题,在这种情况下,新单击的问题将变为粗体,之前单击的问题将恢复正常。
我曾尝试在 CSS 中使用 a:active,但尽管这会使文本在单击时变为粗体,但一旦您松开鼠标,它就会恢复正常。
这是我的CSS
div#newboxes1, div#newboxes2, div#newboxes3{ border: 1px solid black; background-color: #CCCCCC; display: none; padding: 5px; width: 659px;}div#newboxes1 {display:block;}ol#toc { height: 2em; list-style: none; margin: 0; padding: 0; border: none;}ol#toc li { float: left;}ol#toc li a img{ border: none;}ol#toc a { color: #676767; float: left; line-height: 2em; text-decoration: none;}ol#toc li.current { background-color: #e5e5e4; background-position: 0 -60px;}ol#toc li.current a { color: #676767;}ol#toc li.current a:hover { color: #fff; font-weight: bold;}div.content { background: #e6e5e4; padding: 20px; width: 669px; margin: 0px;}div.content a{ color: #000000; text-decoration: underline;}div.content a:active{ font-weight: bold;}div.content a:visited{ font-weight: bold;}
This is my HTML
<ol id="toc"><li class="current"><a href="customer-service_delivery.html"><img src="delivery_0.jpg" alt="Delivery" /></a></li>
<li><a href="customer-service_returns.html"><img src="returns.jpg" /></a></li>
<li><a href="customer-service_contact.html"><img src="contact.jpg" /></a></li>
<li><a href="customer-service_shopping.html"><img src="shopping.jpg" /></a></li></ol>
<div class="content">
<p><a name="newboxes" href="javascript:showonlyone('newboxes1');" >Where is my order? </a></p>
<p><a name="newboxes" href="javascript:showonlyone('newboxes2');" >UK Standard Delivery</a></p>
<p><a name="newboxes" href="javascript:showonlyone('newboxes3');" >UK Next Day Delivery</a></p>
<div name="newboxes" id="newboxes1">
<p>Where is my order answer</p>
</div>
<div name="newboxes" id="newboxes2">
<p>UK Standard Delivery answer</p>
</div>
单击每个链接时调用 Javascript 函数,这会显示/隐藏当前位于彼此之上的相关 div。
下面是javascript
function showonlyone(thechosenone) {
var newboxes = document.getElementsByTagName("div");
for(var x=0; x<newboxes.length; x++) {
name = newboxes[x].getAttribute("name");
if (name == 'newboxes') {
if (newboxes[x].id == thechosenone) {
newboxes[x].style.display = 'block';
}
else {
newboxes[x].style.display = 'none';
}
}
}
感谢您的帮助:)特蕾莎
最佳答案
您必须将此样式添加到您的 css 文件中:
ol#toc li.current a:active {
font-weight: bold;
}
关于javascript - 一种在选择后保持链接粗体的方法(与 :visited) 不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3669884/
我看过的每个示例和样式表都使用 a:visited 来设置链接样式。除了a:visited具有更高的特异性,:visited不应该是等价的和更简单的吗? 最佳答案 TL;DR:在撰写本文时,您是完全正
每当我激活 Woocommerce 时,Woocommerce 都会在 Wordpress 的管理栏中添加“访问商店”。这导致我在那里同时拥有“访问站点”和“访问商店”。 但是,我真的看不出这样做有什
我已经看到了两种方式的例子,特别是维基百科展示了一个例子,其中被访问的对象决定了访问顺序,我认为这是一种听起来很合理的方法。 我处于需要多个访问顺序的情况,因此让访问者决定访问顺序似乎是合理的。但是,
我的网站上有我的帖子模型。我的帖子模型有一个存储访问的列。当用户访问我的帖子时,应该递增 1。我完全知道该怎么做,但我的问题是当我在我的模型中将它递增 1 时,它递增 2!!!!! 我在我的 Cont
使用 C++14,我使用 boost::variant作为编译时多态的一种方式: using MyType = boost::variant; 这两个类都有一个方法 sayHello() .我想调用:
我在使用 a:visited(或另一个可能?)伪类时遇到问题。我想让链接在不同的元素中显示为不同的颜色(.link-box 中的黑色和#main-menu 中的红色,无论它们是否被访问过),他们首先这
nav ul li a:link, a:visited nav ul li a, visited 第一次,我使用方法1 为导航栏中的链接设置颜色。然后,当我在 section 中创建链接时,它采用存储
我已经在 IE F12 开发人员工具下运行了我的 Sharepoint 网站,控制台在我的 HTML 开头提到了以下错误:- SEC7115: :visited and :link styles ca
这篇文章的目的是什么? 在 bigquery 中,我需要使用 caveat 删除重复的行 对于访问者访问具有相同页面名称的页面,重复发生在同一次访问中。 分组不能解决问题 下面,我已尽我所能解释数据、
我有这个 php 代码: mysqli_query($link, 'UPDATE `blog_posts` SET `visit` = `visit` + 1 WHERE `id` = ' . $po
我有一张表,其中包含访问、已完成的应用程序和批准,每行作为邮政编码,我试图将表转换为每行是访问的表。由于我在 Excel 中,我试图在 VBA 中编写一个宏来执行此操作,但这给了我一些不准确的地方。这
我有一个列出信息的页面,您可以在其中单击链接以获取更多详细信息。这些链接中的大多数都是正常的(即没有类),但在某些链接上我设置了类“未发布”(用于未发布的更改),其中样式设置为 color: red
我有一个列出信息的页面,您可以在其中单击链接以获取更多详细信息。这些链接中的大多数都是正常的(即没有类),但在某些链接上我设置了类“未发布”(用于未发布的更改),其中样式设置为 color: red
我在一个数学网站上工作,它有一些练习,页面底部有解决方案。我想让解决方案在用户滚动时隐藏起来,并且需要单击该 block 才能显示答案。我只想使用 css 和 html 来实现这一点。这是我到目前为止
在我的浏览器中,Mac OS 上的 Chrome,文本装饰和背景颜色不适用于以下代码: http://jsfiddle.net/5CYHZ/10/ 为什么会这样? 最佳答案 Mozilla出于隐私原因
我无法在 Firefox 或 IE 中处理 a:visited 超链接 如果我设置 a:visited 的背景颜色,它会正常工作,但不透明度不会设置。 有什么想法吗? 这是我的CSS: a.photo
我正在尝试使用 std::visit 来检查 std::variant。 首先,我声明变体和变体的基(可调用)访问者类: #include #include #include using Ama
我有一个页面,我们在其中显示嵌入式画面仪表板,并且在同一页面上有一个下拉菜单,用户可以使用该下拉菜单加载不同的仪表板,单击我调用的下拉选项 Turbolinks.visit(url, {action:
我想更改页面上两个链接的访问颜色。我有办法做到这一点吗? 最佳答案 仅在您想要不同访问颜色的链接上放置一个类,例如: Different 在 CSS 中,然后以您想要的任何方式设置已访问过的链接类别的
不确定这是否可能,而不必经过几次传递,但我无论如何都会问(我的 XSL 有点生锈) 我有一个 XML 文档,其中包含如下节点:
我是一名优秀的程序员,十分优秀!