如何使css a:点击后活动工作? [英] How to make css a:active work after the click?

查看:116
本文介绍了如何使css a:点击后活动工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让菜单作为选项卡工作。标签本身工作正常,菜单链接是伟大aswell ..但我想删除活动标签的buttom边框,使它看起来像你在那个实际页面。我尝试使用 #id a:active ,但它似乎只有工作,只要我按下的链接。我已经做了虽然由javascript aswell,但我似乎不能找出一种方法来做。



CSS:(请让我知道如果你需要更多的css)

  #navigation a:active {
color:#000;
background:-webkit-gradient(linear,left top,left bottom,from(#DFE7FA),to(#FFF));
border-bottom-width:0px;
}

感谢,
/ Pyracell

解决方案

由于您在上述评论中的演示链接,JavaScript不会有任何帮助,应该在您的PHP代码中完成。
以下行的内容:

 < a<?php if(this_tab_is_selected){?> class ='active'<?php}?> href ='LINK_TO_TAB'> 
TAB_NAME
< / a>

提到更改标签页是重定向到另一个页面可能有助于从开始xD

根据您创建标签页和代码的方式,将 this_tab_is_selected 更改为返回true的代码选择标签。



PS当然同时保持在上面的答案中提到的修改CSS。 (这是将 #navigation a:active 更改为 #navigation a.active


I am trying to make a menu working as tabs. The tabs themselves are working fine and the menu links are great aswell.. But I'd like to remove the buttom border of the active tab, to make it look like you're on that actual page. I've tried using #id a:active but it seems to work only as long as I press the link. I've had the though about doing it by javascript aswell, but I can't seem to figure out a way to do it. Here's my css for active.

CSS: (please let me know if you'll need more of my css)

#navigation a:active {
    color: #000;
    background: -webkit-gradient(linear, left top, left bottom, from(#DFE7FA), to(#FFF));
    border-bottom-width:0px;
}

Thanks, /Pyracell

解决方案

Due to your demo link in the comments above, JavaScript will not be any helpful, it should be done in your PHP code. Something in the lines of:

<a <?php if (this_tab_is_selected){ ?>class='active' <?php } ?>href='LINK_TO_TAB' >
    TAB_NAME
</a>

Mentioning that changing tabs is redirecting to another page could have helped wither better responses from the start xD

Depending on how you are creating the tabs and on your code, change the this_tab_is_selected to a code that returns true for the selected tab.

P.S. of course while keeping the modification mentioned in previous answer for you CSS. (Which is to change #navigation a:active to #navigation a.active)

这篇关于如何使css a:点击后活动工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆