简体   繁体   中英

Overriding Bootstrap @media (min-width: 768px) using CSS not working

On the navigation on my website, I am using bootstrap and for my active page, I am trying to add a horizontal line below it.

For the navigation, Bootstrap has set the padding to

@media (min-width: 768px)
    navbar.less:286
    .navbar-nav>li>a {
    padding-top: 15px;
    padding-bottom: 15px;
}

I am using border-bottom to act as the horizontal line below to show the active page, but i dont want it to show 15px below the page title.

So I inseted this code into my custom.css file:

.activeNavPage  {
    border-bottom: solid 1px rgb(255, 95, 0);
    padding-bottom: 10px;
    margin-bottom: 4px;
}

As well as:

@media (min-width: 768px)
navbar.less:286
.navbar-nav>li>a {
    padding-top: 15px;
    padding-bottom: 10px;
}

To try and override the existing boostrap CSS, yet my @media query does nothing and my .activeNavPage CSS only apples style for the border and the margin, but it does not override the padding neither.

Try adding !important. Such as padding-left:10px !important;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM