Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Lea Marolt
5,127 PointsModifying bootstrap not working quite right
Okay, so. I've gone through a bunch of videos on this site, and I decided I wanted to make myself a website.
I decided to start with bootstrap, and see where that takes me. So far so good... it looks like this: http://img.photobucket.com/albums/v255/leamarschein/website1_zps3aa3b2c6.png
But I ran into a problem. Well 2 problems.
The first one happens when I shrink down the size of my browser. Everything flows nicely, and all: http://img.photobucket.com/albums/v255/leamarschein/website2_zps7c5743be.png
BUT for some reason I can' change the border color of the drop down menu's icon. I was able to change the border style, the background color, the border style even... BUT NOT the border COLOR. Even though I manipulated bootstrap's CSS, the color stayed black (where as everything else I changed... changed accordingly).
http://img.photobucket.com/albums/v255/leamarschein/website3_zps5ce02e3d.png
Why? I'm so confused :(
Now, on to problems numero dos: I'm trying to make each of my website's "subsections", like blog, contact, playground... in different color schemes, like so:
http://img.photobucket.com/albums/v255/leamarschein/website4_zpsb6259bf7.png
But unfortunately, for some reason, I can't change the background color of the navigation elements (the li elements on the right).
For this, I can't really go into the bootstrap's css, because I've manipulated that one to look the way the homepage does (I know, I really shouldn't have done that, but it's my first time, okay?).
Now the problem I'm facing, is that in my own CSS file that's overriding the bootstrap one, I think I'm doing the right thing to target the li elements: HTML: <div class="navbar navbar-inverse navbar-fixed-top h_nav blog_nav"> <div class="container"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <div class="navbar-brand h_title"><a href="index.html">hellosunschein*</a></div> <div class="nav-collapse collapse"> <ul class="nav navbar-nav pull-right h_nav_nav_blog"> <li><a href="blog.html">Blog</a></li> <li><a href="contact.html">Contact</a></li> <li><a href="playground.html">Playground</a></li> <li><a href="resources.html">Resources</a></li> </ul> </div><!--/.nav-collapse --> </div> </div> CSS: ul.h_nav_nav_blog > li:hover { font-family: georgia; background-color: purple; }
This is how it ends up looking when I hover over it: http://img.photobucket.com/albums/v255/leamarschein/website5_zps25713140.png
As you can see the font-family does get changed (which is why I believe there's nothing wrong with how I'm targeting the elements), but the background color does not.
Can anyone explain why this is happening :(? I'm at my wits' end.
4 Answers
Leslie Hui
3,330 PointsHi Lea,
1) To change the border colour, look for .navbar .btn-navbar and change this line of code or you can override it in your own CSS.
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
2) To use different color schemes for your navigation. Add a ID to your BODY tag, and you manipulate the colour with CSS.
For example:
body#index navbar-inner { background-color: red; }
3) To change the hover colour, override this css rule:
.navbar .nav > li > a:hover
You can always use the inspector in your browser to check which CSS is taking place of which element.
Hope this helps.
Lea Marolt
5,127 Points1.) .navbar .btn-navbar doesn't exist in my Bootstrap file :(
It's the 3.0 version, so if you were referencing the older one, maybe that's the problem. If you weren't... then maybe I accidentally deleted something.
2.) Thanks (:, that's probably the best way to go about it
3.) This didn't work, neither did it work when I tried it my "previous, awkward way" by adding > a:hover there.
- Also, note: Silly me, I just noticed my HTML snipped didn't come through. Duh. Here's a screenshot, seeing I don't know how to properly use the "code" markdown.
http://img.photobucket.com/albums/v255/leamarschein/ScreenShot2013-08-08at44620PM_zps7b7266a9.png
Thank you so much for your answers, though.
Leslie Hui
3,330 PointsI'm still using Bootstrap version 2. Let me get version 3 and check for you. Btw, it will good if you could upload it to a server and i can check it for you.
Leslie Hui
3,330 Points1) Change/override the border colour in this rule .navbar-toggle.
border: 1px solid your_colour;
3) Change/override this rule .navbar-nav > li > a:hover, .navbar-nav > li > a:focus.
background-color: your_colour;
Lea Marolt
5,127 PointsThe third screenshot shows that I've already tried this, and it hasn't worked :( (for number 1)
The solution to 3 also doesn't work :(
Lea Marolt
5,127 PointsI'm still in the middle of uploading all my files to the web, so you can see them. I'm sorry it's taking me so long.
Leslie Hui
3,330 PointsThen i really have to look at the real markup to see what's happening.
Lea Marolt
5,127 PointsOkay, this isn't quite going as planned. It's going to take me quite a bit longer to do this. Do you think you can look at these tomorrow?
Leslie Hui
3,330 PointsOk sure or you can always send me the zip file if you want.
Lea Marolt
5,127 PointsWell... that would work, too. How should I send it to you. Would you like me to upload it anywhere specific?
Lea Marolt
5,127 PointsMmkay, I'll have it uploaded in 10ish minutes. I need to ssh in another computer to do this, as I currently don't own a domain.
Jake White
41,730 PointsI'm currently doing front end for a site using bootstrap 3.0. It's possible to get the border color changed. I used the developer tools and was able to find it. www.teamalabaster.com/boxd