How to change the style of nav-pills and navbar?

user2953607

I am developing the frontend of a Website and I'm rather new to Ruby and Rails, css and bootstrap. Following the documentation, I have a very nice navbar at the top of my page tailored to my needs by changing options in the css file.

.navbar {
  background-color: #3a2665;
  color: #ffffff !important;
}

.navbar .nav {
  padding-top: 15px;
  padding-bottom: 15px;
}

.navbar .nav > li > a {
  color: #ffffff !important;
  font-family: 'Oswald', sans-serif;
  font-size: 1.5em;
}

I also need a footer with navigations options, this time with the li elements in a different style from the navbar at the top of the page. I tried using nav-pills but do not seem to be able to modifiy the li elements, they follow the navbar style. I only seem to alter anything when I throw in extra !important statements.

.nav-pills > li > a {
  color: #ffffff;
  font-family: 'Open Sans', sans-serif !important;
  font-size: 0.8em ;
  padding: 1px 1px 1px ;
}

My specific question is what is the hierarchical dependency of nav, navbar and nav-pills, so that I can change the style of each of them separately? Does anybody have a pointer? What is the role of !important ? It overwrites but why would I need it if I'm specifying nav-pills in my css file?

Also is it "best practice" to use a navbar also as a footer? In the documentation I read, it seems to indicate that is mostly used in the header.

Any pointers will be much appreciated!

Bojan Petkovski

You can make it like this so you don't have to use !important to override the css style

.navbar {
  background-color: #3a2665;
  color: #ffffff;
}

.navbar .nav {
  padding-top: 15px;
  padding-bottom: 15px;
}

.navbar .nav > li > a {
  color: #ffffff;
  font-family: 'Oswald', sans-serif;
  font-size: 1.5em;
}

footer .navbar{
    color: #ff0000; /* TO change the color in the footer*/
}
footer .navbar .nav > li > a {
  color: #ff0000; /* TO change the color in the footer*/
}

The style you want the classes to inherit in the footer you leave them as they are :)

And yes you can use navbar in footer :)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to make menu, navbar nav-pills nav-stacked collapse Twitter-bootstrap 3.0

From Dev

How to center nav bar pills?

From Dev

Bootstrap 3: Can a nav-pills nav menu collapse like navbar?

From Dev

Change active "nav-pills" color in twitter-bootstrap

From Dev

how to change navbar color when nav-toggle is clicked

From Dev

how to increase space between nav-pills bootsrap?

From Dev

how to increase space between nav-pills bootsrap?

From Dev

How to change the style of a NAV element when it's selected with JavaScript only?

From Dev

How can I get "divider" displayed for "nav-pills" and "nav-stacked"

From Dev

nav-pills nav-stacked not working

From Dev

How to style a typeahead in a nav in bootstrap?

From Dev

How do I change the CSS of pills ? (angular2)

From Dev

How to justify navbar-nav in Bootstrap 3

From Dev

how to insert affix navbar, and the nav fixed position

From Dev

how to insert affix navbar, and the nav fixed position

From Dev

How do I change the nav drawer text style when using the Android Project Template?

From Dev

Bootstrap navbar-brand title above navbar-nav -- how?

From Dev

Bootstrap 3 nav-pills not working

From Dev

Changing the height of Bootstrap's nav-pills

From Dev

Simple way to navigate through bootstrap nav pills

From Dev

Disabling stacking on nav-pills in bootstrap 3?

From Dev

Changing the active class as well as content in nav pills

From Dev

Trying to customize nav-pills in Twitter Bootstrap

From Dev

Disabling stacking on nav-pills in bootstrap 3?

From Dev

bootstrap nav pills menu custom size width

From Dev

Weird looking menu (bootstrap nav-pills)

From Dev

Bootstrap nav-pills in vue js 2

From Dev

How to change these colors on Navbar?

From Dev

How to change these colors on Navbar?

Related Related

  1. 1

    How to make menu, navbar nav-pills nav-stacked collapse Twitter-bootstrap 3.0

  2. 2

    How to center nav bar pills?

  3. 3

    Bootstrap 3: Can a nav-pills nav menu collapse like navbar?

  4. 4

    Change active "nav-pills" color in twitter-bootstrap

  5. 5

    how to change navbar color when nav-toggle is clicked

  6. 6

    how to increase space between nav-pills bootsrap?

  7. 7

    how to increase space between nav-pills bootsrap?

  8. 8

    How to change the style of a NAV element when it's selected with JavaScript only?

  9. 9

    How can I get "divider" displayed for "nav-pills" and "nav-stacked"

  10. 10

    nav-pills nav-stacked not working

  11. 11

    How to style a typeahead in a nav in bootstrap?

  12. 12

    How do I change the CSS of pills ? (angular2)

  13. 13

    How to justify navbar-nav in Bootstrap 3

  14. 14

    how to insert affix navbar, and the nav fixed position

  15. 15

    how to insert affix navbar, and the nav fixed position

  16. 16

    How do I change the nav drawer text style when using the Android Project Template?

  17. 17

    Bootstrap navbar-brand title above navbar-nav -- how?

  18. 18

    Bootstrap 3 nav-pills not working

  19. 19

    Changing the height of Bootstrap's nav-pills

  20. 20

    Simple way to navigate through bootstrap nav pills

  21. 21

    Disabling stacking on nav-pills in bootstrap 3?

  22. 22

    Changing the active class as well as content in nav pills

  23. 23

    Trying to customize nav-pills in Twitter Bootstrap

  24. 24

    Disabling stacking on nav-pills in bootstrap 3?

  25. 25

    bootstrap nav pills menu custom size width

  26. 26

    Weird looking menu (bootstrap nav-pills)

  27. 27

    Bootstrap nav-pills in vue js 2

  28. 28

    How to change these colors on Navbar?

  29. 29

    How to change these colors on Navbar?

HotTag

Archive