Search code examples
htmlcssbootstrap-grid

Active class now work corretly in HTML


I have a problem in my html. I can't find how can i solve it.

[class="active" then Home mark with red underline. default][1]

[When i click, red underline disappered][2]

[When i click anywhere, it is come again][3]

/*input[type=text] {
    width: 40px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
    background-image: url('glyphicons-28-search.png');
    background-position: 10px 10px; 
    background-repeat: no-repeat;
    padding: 12px 20px 12px 25px;
    -webkit-transition: width 0.4s ease-in-out;
    transition: width 0.4s ease-in-out;
	margin-left: 10px;
}*/
input[type=text] {
    width: 130px;
    box-sizing: border-box;
    border: 2px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
    background-image: url('glyphicons-28-search.png');
    background-position: 10px 10px; 
    background-repeat: no-repeat;
    padding: 12px 10px 10px 40px;
    -webkit-transition: width 0.4s ease-in-out;
    transition: width 0.4s ease-in-out;
    margin-left: 10px;
    margin-bottom: 0px;
}
input[type=text]:focus {
    /*border: 2px solid #FF0000;*/
}
body {
    font: 400 15px Lato, sans-serif;
    line-height: 1.8;
    color: #818181;
    background-color: #d9d9d9;
}
h2 {
    font-size: 24px;
    text-transform: uppercase;
    color: #303030;
    font-weight: 600;
    margin-bottom: 30px;
}
h4 {
    font-size: 19px;
    line-height: 1.375em;
    color: #303030;
    font-weight: 400;
    margin-bottom: 30px;
}  
.container{
    width: 100%;
    margin: auto;
}
.navbar {
    margin-bottom: 0;
    border: 0;
    font-size: 15px !important;
    line-height: 1.42857143 !important;
    letter-spacing: 1px;
    border-radius: 0;
    background-color: white;
    padding: 30px 30px 30px 30px;
}
.navbar .navbar-nav {
    display: inline-block;
    float: none;
    border-color: white;
}
.navbar-nav li a:hover, .navbar-nav li.active a{
    border-bottom: 2px solid red;
    color: black !important;
    background-color: white !important;
}
.navbar .navbar-collapse {
    text-align: center;
}
.center {
    width: 100%;
    margin: 10px 50px 0px 50px;
}
.right {
    float: right;
    margin-right: 130px;
    margin-left: 260px;
}
.top {
    margin-top: 150px;
}
.img {
    padding-right: 50px;
    width: 80%;
}

Thanks for helping!


Solution

  • Just add this CSS :

    .navbar-nav li.active a:focus{
        border-bottom: 2px solid red;
    }
    

    if this not works then just add important :

    .navbar-nav li.active a:focus{
        border-bottom: 2px solid red !important;
    }