Tech Tips

  1. Uncategorized
  2. 71 view

[TwitterBootstrap][CSS]Change navbar

20140921_twitterbootstrap_navbar_string_color

Contents

Overview

A page which has how to change navbar of Twitter Bootstrap looks nothing.
This is a memo for it.
20140921_twitterbootstrap_navbar_origin

Environment

  • OS
    • Linux www4322gi 3.2.0-64-generic #97-Ubuntu SMP Wed Jun 4 22:04:21 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
  • Twitter Bootstrap
    • version: 2.3.2

Prepare

Download Twitter Bootstrap and make sample HTML file.
wget http://getbootstrap.com/2.3.2/assets/bootstrap.zip
unzip bootstrap.zip
rm bootstrap.zip
vim sample.html

sample.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Bootstrap, from Twitter</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="http://sample.com/bootstrap/css/bootstrap.css" rel="stylesheet">
    <style>
      body {
        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      }
    </style>
    <link href="http://sample.com/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
  </head>

  <body>

    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="brand" href="#">Project name</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li><a href="#">Home</a></li>
              <li><a href="#about">About</a></li>
              <li><a href="#contact">Contact</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container">

      <h1>Bootstrap starter template</h1>
      <p>Use this document as a way to quick start any new project.<br> All you get is this message and a barebones HTML document.</p>

    </div> <!-- /container -->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
    <script src="http://sample.com/bootstrap/js/bootstrap.js"></script>

  </body>
</html>

Change navbar color

bootstrap/css/bootstrap.css

...
.navbar-inverse .navbar-inner {
  background-color: #1b1b1b;
  background-image: -moz-linear-gradient(top, #222222, #111111);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111));
  background-image: -webkit-linear-gradient(top, #222222, #111111);
  background-image: -o-linear-gradient(top, #222222, #111111);
  background-image: linear-gradient(to bottom, #222222, #111111);
  background-repeat: repeat-x;
  border-color: #252525;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);
}
...
Change it to blue.
...
.navbar-inverse .navbar-inner {
  background-color: #1b1b1b;
  background-image: -moz-linear-gradient(top, #0000cd, #0000ff);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0000cd), to(#0000ff));
  background-image: -webkit-linear-gradient(top, #0000cd, #0000ff);
  background-image: -o-linear-gradient(top, #0000cd, #0000ff);
  background-image: linear-gradient(to bottom, #0000cd, #0000ff);
  background-repeat: repeat-x;
  border-color: #006400;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000cd', endColorstr='#ff0000ff', GradientType=0);
}
...
20140921_twitterbootstrap_navbar_bar_color

Change color of string

...
.navbar-inverse .brand,
.navbar-inverse .nav > li > a {
  color: #000000;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.navbar-inverse .brand:hover,
.navbar-inverse .nav > li > a:hover,
.navbar-inverse .brand:focus,
.navbar-inverse .nav > li > a:focus {
  color: #999999;
}

.navbar-inverse .brand {
  color: #000000;
}
...
Change it to white.
...
.navbar-inverse .brand,
.navbar-inverse .nav > li > a {
  color: #ffffff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.navbar-inverse .brand:hover,
.navbar-inverse .nav > li > a:hover,
.navbar-inverse .brand:focus,
.navbar-inverse .nav > li > a:focus {
  color: #aaaaaa;
}

.navbar-inverse .brand {
  color: #ffffff;
}
...
20140921_twitterbootstrap_navbar_string_color

Uncategorized recent post

  1. Run Amazon FreeRTOS on M5Stack Core2 for AWS …

  2. Udacity Self-Driving Car Engineer Nanodegree …

  3. Install sbt 1.0.0 and run sample template

  4. Visualization of Neural Network and its Train…

  5. [Machine Learning]Created docker image includ…

関連記事

PAGE TOP