Solved

Modify Twitter Bootstrap Header Navbar

Posted on 2014-03-24
3
1,100 Views
Last Modified: 2014-03-30
I want to edit the Navbar of the Twitter bootstrap package so that the Navbar stretches 100% width of the screen and I also want to be able to modify the background color or image of the Navbar.  How so I go about doing this?  Thanks!
0
Comment
Question by:VBBRett
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39949709
You simply want the fixed top.  This is the sample http://getbootstrap.com/examples/navbar-fixed-top/ and code
 <!-- Fixed navbar -->
    <div class="navbar navbar-default navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">Project name</a>
        </div>
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="#">Action</a></li>
                <li><a href="#">Another action</a></li>
                <li><a href="#">Something else here</a></li>
                <li class="divider"></li>
                <li class="dropdown-header">Nav header</li>
                <li><a href="#">Separated link</a></li>
                <li><a href="#">One more separated link</a></li>
              </ul>
            </li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="../navbar/">Default</a></li>
            <li><a href="../navbar-static-top/">Static top</a></li>
            <li class="active"><a href="./">Fixed top</a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>

Open in new window

To change the color, it is  best to create a new css sheet typically called custom.css.  
You can either style the
.navbar.navbar-default.navbar-fixed-top{
 /*style here */
}

Open in new window

or you can add a class to the nav bar and style on that class
0
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 500 total points
ID: 39949712
Here is a working sample http://jsbin.com/nagitifa/1/edit?html,output using
    .navbar.navbar-default.navbar-fixed-top{background-color:red;}

Open in new window

0
 

Author Comment

by:VBBRett
ID: 39955896
Hello guys!  Unfortunately I ran into a problem with a PNG image as a background.  It appears the header plays well with background colors but gets weird with background images.  How do I fix that?  I needed my header to be at least 80 pixels in height with the background image and now I have this stupid line below the header with the div stuck at only 59 pixels in height.  I guess bootstrap has a bit of a learning curve, can anybody give a suggestion?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Changing alignment and creating border 6 38
Create tabs to show divs 9 35
CSS SASS 4 34
Media Queries  not Firing 6 17
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question