Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.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 伪类:当前_Html_Css_Css Selectors_Pseudo Class - Fatal编程技术网

Html 伪类:当前

Html 伪类:当前,html,css,css-selectors,pseudo-class,Html,Css,Css Selectors,Pseudo Class,当您在该页面上时,我试图使我的菜单栏background变为黑色,例如,如果您在SFX页面上,SFX选项卡将变为黑色,而不是红色 这是我的HTML: <div id="menuBar" align="left"> <table cellspacing="5" > <tr> <td><a href="index2.php">Home</a></td>

当您在该页面上时,我试图使我的菜单栏
background
变为黑色,例如,如果您在SFX页面上,SFX选项卡将变为黑色,而不是红色

这是我的HTML:

<div id="menuBar" align="left">
    <table cellspacing="5" >
        <tr>
            <td><a href="index2.php">Home</a></td>
            <td><a href="editorial.php">Editorial</a></td>
            <td><a href="sfx.php">SFX</a></td>
            <td><a href="occasion.php">Occasion</a></td>
            <td><a href="artwork.php">Artwork</a></td>
            <td><a href="body.php">Body Painting</a></td>
            <td><a href="contact.php">Contact</a></td>
            <td><a href="about.php">About</a></td>

        </tr>
    </table>
</div>

我什么都试过了,但都没用。我确信它很简单,但我不知道它是什么

除了作为一个最近才引入的全新伪类之外。具有讽刺意味的是,同一草案确实为当前文档的链接提出了另一个新的伪类,称为,但这两个类都没有实现,因为它们只是最近才被提出的。(事实上,我刚刚发现,从2014年5月起,
:local link
已从中删除-不知道为什么,但实现此类伪类的可能性更大。)

无论哪种方式,当前都没有指向当前页面的链接的伪类。您将需要使用PHP来确定这些链接中哪些指向当前页面,向相应的元素添加一个
class=“current”
,并以该类为目标

#menuBar {
    position: absolute;
    left: 0;
    right: 0;
    margin: auto;
    width: 810px;
    height: 30px;
    top: 53px;
    vertical-align:central;
}
#menuBar a {
    background: #AA0000;
    padding-top: 2px;
    padding-bottom: 2px;
    padding-left: 11px;
    padding-right: 11px;
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    color: Beige;
    text-decoration: none;
    font-weight:bold;
    font-size:18px;
    font-family: Gabriola,"Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", Verdana, sans-serif;    
}

#menuBar a:hover {
    background: #000000;
    transition:all .3s ease-in-out;
    -moz-transition: all .3s ease-in-out;
    -o-transition: all .3 ease-in-out;
    -webkit-transition: all .3s ease-in-out;
}

#menuBar a:focus {
    background:#000000;
}

#menuBar a:current {
    background:#000000;
}