a:active不工作 [英] a:active is not working
问题描述
我很困惑这里,
a:active
无效, $ c>:hover 工作正常,
我尝试了很多东西,但这些都让我困惑,真的很困惑。
我刚刚在表中添加了链接,我已经添加了单元格的类, .menu1
。现在当我访问活动页面时,活动链接不会被高亮显示。
the a:active
is not working , but the :hover
is working fine,
I have tried a lot of things but this ones is got me stuck, and is really confusing.
I have just added links in the table, I have added the cells to the class, .menu1
. now when I visit the active page, the active link is not highlited.
这是我的代码:
HTML:
<table style="margin-bottom:15px" >
<tr>
<td><a href="ts_cms.php"><img src="../images/admin/prop_btn.png"></a></td>
<td><a href="#"><img src="../images/admin/pack_btn.png"></a></td>
<td> <a href="#"><img src="../images/admin/blog_btn.png"></a></td>
</tr>
<tr>
<td class= "menu1"><a href="ts_cms.php">Add property</a></td>
<td class= "menu1"><a href="#">Add package</a></td>
<td class= "menu1"><a href="#">Add Blog</a></td>
</tr>
</tr>
<tr>
<td class= "menu1"><a href="#">Remove property</a></td>
<td class= "menu1"><a href="#">Remove package</a></td>
<td class= "menu1"><a href="#">Remove Blog</a></td>
</tr>
</tr>
<tr>
<td class= "menu1"><a href="#">Update property</a></td>
<td class= "menu1"><a href="#">Update package</a></td>
<td class= "menu1"><a href="#">Update Blog</a></td>
</tr>
</tr>
<tr>
<td class= "menu1"><a href="#">List all properties</a></td>
<td class= "menu1"><a href="#">List all packages</a></td>
<td class= "menu1"><a href="#">List all Blogs</a></td>
</tr>
</table>
CSS:
.menu1 {
background-repeat:no-repeat;
background-size:auto;
margin-left:10px;
background-position:center;
background-image:url(../images/admin/menu_1.png);
vertical-align:central;
text-align:center;
color:#FFF;
}
,
.menu1:hover {
color:#0CF;
background-image:url(../images/admin/menu_1_hover.png);
}
.menu1 a {
color:#FFF;
}
.menu1 a:hover {
color:#0CF;
}
.menu1 a:active {
color:#000;
}
推荐答案
:active
并不意味着具有解析到当前页面的URL的 href
属性。
它表示当被激活时(例如点击)。
:active
doesn't mean "has an href
attribute that resolves to the URL of the current page".
It means "While being activated" (e.g. clicked on). You can use it for things like making something that looks like a button look like it is being depressed when it is clicked on.
CSS没有一个选择器可以用来显示一个按钮,具有解析为当前页面的URL的 href
属性。您需要修改DOM。通常,您可以通过生成导航菜单服务器端并添加一个额外的类或删除< a>
元素(也许使用 < span>
)。
CSS doesn't have a selector for "has an href
attribute that resolves to the URL of the current page". You'll need to modify the DOM instead. Typically you would do this by generating your navigation menu server side and either adding an extra class or removing the <a>
element (and maybe using a <span>
instead) for the current page.
这篇关于a:active不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!