Style twitter bootstrap navbar witout applying that styling to collapsed navbar?

I applied some styles to the twitter bootstrap navbar, and then realised I didn't want these on the collapsed version. I first looked for some applied class to differentiate between a collapsed and uncollapsed bar, but I can't find one. I am going to try to use JS to add a class conditionally ... is there a better way to do this?

Answers:

Answer

Wrap your styles in a media query, like bootstrap does:

@media (min-width: 980px) {
    /* your conditional CSS*/
}
Answer

The current default collapse width for bootstrap navbar is now 768px so in order to write css style for only a collapsed navbar you would use:

@media (min-width 768px) {
}

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.