Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.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 使用类活动引导更改li的css_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html 使用类活动引导更改li的css

Html 使用类活动引导更改li的css,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我在我的页面上使用引导: <?php echo '<div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-targe

我在我的页面上使用引导:

<?php echo '<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="index.php">Project name</a>
    </div>
    <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav">
            <li class="active" id="one"><a href="index.php">Home</a></li>';?   >
 <?php
 if (isset($_COOKIE['id']) and isset($_COOKIE['hash'])) {
 echo '<li><a href="logout.php">Logout</a></li>';
 }
 ?>
 <?php echo '</ul>
    </div>
 </div>
 </div>';

但是我的代码不起作用

请删除
li之间的空格。活动
已更改
li.活动
元素

css

 li.active{
    background-color: red;
}

删除
li之间的空格。活动
已更改
li.活动
元素

css

 li.active{
    background-color: red;
}

试试

.navbar-default .navbar-nav > .active{
  color: #000; background: red;
}
.navbar-default .navbar-nav > .active > a, 
.navbar-default .navbar-nav > .active > a:hover, 
.navbar-default .navbar-nav > .active > a:focus {
  color: #000;
  background: red;
}
试试

.navbar-default .navbar-nav > .active{
  color: #000; background: red;
}
.navbar-default .navbar-nav > .active > a, 
.navbar-default .navbar-nav > .active > a:hover, 
.navbar-default .navbar-nav > .active > a:focus {
  color: #000;
  background: red;
}
请尝试一下:

li.active{
    background-color: red !important;
}
请尝试一下:

li.active{
    background-color: red !important;
}
您可以使用此代码

li.active{
背景色:红色;
}
您可以使用此代码

li.active{
背景色:红色;
}