Click here to Skip to main content
15,886,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I working on my web project I'm suing the bootstrap and I make a different between the header background color, body and footer. like this :
-----------------------------
|       HEADER               |
|----------------------------|
|                            |
|                            |
|     BODY                   |
|                            |
|                            |
|----------------------------|
|         FOOTER             |
|-----------------------------

the default of bootstarp it's like white then when using the inverse the color of background turn to black. But i want other color on the background not using black or white. And I got no idea to code the problem. I stuck. I just using the default css from bootstrap. this is the html code from the header content :

HTML
<!DOCTYPE HTML>
<html>
   <header>
       <!-- All connection CSS and JS from Bootstrap -->
       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
       <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
       
       <meta name="viewport" content="width=device-width, initial-scale=1.0">
       
       <title>rafidkarim</title>
    </header>
    
<body>
       <div class="navbar navbar-default navbar-static-top">
            <div class="container">
               <a href="index.html" class="navbar-brand">
                   <img src="images/rafidkarim3.png"/>
                </a>
                
                <button class="navbar-toggle" data-toggle = "collapse" data-target=".navHeaderCollapse">
                   <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                
                <div class="collapse navbar-collapse navHeaderCollapse">
                     <ul class="nav navbar-nav navbar-right">
                    
                         <li class="active"><a href="#">HOME</a></li>
                         <li><a href="#">PRODUCT</a></li>
                    </ul>
               </div>
            </div>
      </body>
</html>
Posted
Updated 22-Oct-15 5:57am
v2

Override the bootstrap css to your own css, e .g. bootstrap has .btn-danger and uses red color for it. So what you can do is, change the color for this button.
Create your own .css file and reference it to your html, and write the bootstrap overridden css classes in it.

Now, answer to your question would be something like,
CSS
.navbar 
{
    background-color:#f44;
    color:#fff;
    border:0;
}

I just overridden the bootstrap's navbar style to my own style.
Make sure that you don't make changes in any of the bootstrap's stylesheets & jQuery. Create you custom css with the same name class and override the css rule to your wish.

Hope that's clear :)

-KR
 
Share this answer
 
A color is composed of 3 (or 4) components : red, green, blue (and eventually transparency).

The formula to get the 'opposite' color of a given color is:
C#
Color originalColor;

Color oppositeColor = Color.FromARGB(
   originalColor.A,       // Here I keep the same transparency value
   255 - originalColor.R,
   255 - originalColor.G,
   255 - originalColor.B
);

Hope this helps.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900