Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS a:活动伪类不工作_Html_Css - Fatal编程技术网

Html CSS a:活动伪类不工作

Html CSS a:活动伪类不工作,html,css,Html,Css,我知道以前有人在这里问过这个问题,我在谷歌上搜索了一下,看看能不能让它运行起来,但我找到的解决方案对我根本不起作用。 这是我的密码 <div id="rightbar" class="float-r"> <table width="100%" cellpadding="0" cellspacing="0"> <tbody><tr> <td colspan="2"><a cla

我知道以前有人在这里问过这个问题,我在谷歌上搜索了一下,看看能不能让它运行起来,但我找到的解决方案对我根本不起作用。 这是我的密码

<div id="rightbar" class="float-r">
        <table width="100%" cellpadding="0" cellspacing="0">
        <tbody><tr>
            <td colspan="2"><a class="block active" href="dashboard.php">My Dashboard</a></td>
        </tr>           
        <tr>
            <td><a class="block" href="profile.php">My Profile</a></td>             
        </tr>           
        <tr>
            <td><a class="block" href="edit_profile.php">Edit Personal Details Form</a></td>                
        </tr>
        <tr>
            <td><a class="block" href="edit_form.php">Edit Members Form</a></td>                
        </tr>
        <tr>
            <td colspan="2" class="last-child"><a style="border-bottom:solid 1px #eaeaea;width:235px;" class="block" href="logout.php">Log Out</a></td>             
        </tr>
        </tbody></table>
    </div>

.float-r {
 float: right;
}

#rightbar {
background: #ffffff;
float: right;
width: 250px;
margin-top: 10px;
height: 530px;
margin-right: 10px; 
border-bottom: solid 1px #c8c9c9;
}

#rightbar a {
width:235px;
color: #000;
font-size:14px;
text-decoration:none;
}

#rightbar a:hover{
background-color:#efefef;
width:235px;
}

#rightbar a:active{
background-color:#eaeaea;
width:235px;
}

.浮球-r{
浮动:对;
}
#右栏{
背景:#ffffff;
浮动:对;
宽度:250px;
边缘顶部:10px;
高度:530px;
右边距:10px;
边框底部:实心1px#c8c9c9;
}
#右栏a{
宽度:235px;
颜色:#000;
字体大小:14px;
文字装饰:无;
}
#右键a:悬停{
背景色:#EFEF;
宽度:235px;
}
#右栏a:活动{
背景色:#eaeaea;
宽度:235px;
}

我想当我点击一个链接并将鼠标悬停在外时,a:active上的背景会发生变化,比如Stackoverflow,如果你滚动到顶部,你会看到问题、标签、用户、徽章等选项。如果我点击每个链接,背景会变为橙色。我想要那样的东西。谢谢。

您的代码运行良好。你可以在这里看到当我把它切换到红色,当你按住鼠标点击它的工作正常

为了清晰起见,这里只换了红色

 #rightbar a:active{
background-color:red;
width:235px;
}

您选择了非常接近的颜色:这就是为什么很难看到差异。

您用什么切换活动?一切似乎都正常。你认为什么不起作用?你有没有试过#rightbar table tbody tr td a:hover{背景色:#efefeff;宽度:235px;}@AdvaitS yeap仍然不起作用请看我的意思是,当我点击链接并悬停时,我希望它仍然保持红色,举个例子,如果你滚动到顶部,你会看到像问题这样的选项,标签,用户,徽章,如果我点击每一个链接,背景会变成橙色。我想要像这样的东西that@Rhyno_xD这与css:active的功能完全不同。您可能想尝试一些类似于将类交换到项目上以及更改css的方法。例如,堆栈溢出使用类“youarehere”来设置样式,就像您在那里所说的那样。CSS:active就是在你点击这个项目的时候。请参阅此处以供参考-我明白您的意思,它现在可以工作了,但我正在使用php include将标题添加到页面中,这样做会有点问题,但我会想一些办法。非常感谢。