dkjain
dkjain

Reputation: 871

Overriding Bootstrap media query does not work when placed in separate file. Why?

The following bootstrap media queries changes the break-point to 992px (from 768px) for the bootstrap's default navbar's collapse.

@media (max-width: 1200px) {
    .navbar-header {
        float: none;
    }
    .navbar-left,.navbar-right {
        float: none !important;
    }
    .navbar-toggle {
        display: block;
    }
    .navbar-collapse {
        border-top: 1px solid transparent;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
    }
    .navbar-fixed-top {
        top: 0;
        border-width: 0 0 1px;
    }
    .navbar-collapse.collapse {
        display: none!important;
    }
    .navbar-nav {
        float: none!important;
        margin-top: 7.5px;
    }
    .navbar-nav>li {
        float: none;
    }
    .navbar-nav>li>a {
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .collapse.in{
        display:block !important;
    }
}

When I put the above in a separate file and link it in the HTML below bootstrap.css, the rule does not take effect however if I place it directly in bootstrap.css (at the end) then it works.

Can anybuddy tell me why it doesn't get applied when I put it in another file and linked to html ?

Upvotes: 1

Views: 634

Answers (2)

John Slegers
John Slegers

Reputation: 47091

When I put the above in a separate file and link it in the HTML below bootstrap.css, the rule does not take effect however if I place it directly in bootstrap.css (at the end) then it works.

Check the path of your <link rel="stylesheet" type="text/css" href="path/custom.css">. It's probably wrong.

Upvotes: 1

Vinaya
Vinaya

Reputation: 363

Add this css file after bootstrap css file, also check the file path and name. It'll work.

Upvotes: 2

Related Questions