Make part of header a different colour to the rest - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Header

Description

Make part of header a different colour to the rest

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

header {<!-- w  w w .  j  a  v  a2s .  c  om-->
   min-height: 20px;
   background-color: white;
}
header a {
   color: #3b4b5d;
   text-decoration: none;
   display: block;
}
section h1 {
   margin: 0;
}
.top-nav {
   width: 100%;
   margin: auto;
   overflow: hidden;
}
.nav-logo img {
   float: left;
   width: 120px;
   padding: 20px 12px 20px 20px;
}
.left-nav ul li {
   margin: 10px 16px 0px 16px;
   padding: 0px 0px 0px 24px;
   font-size: 16px;
   text-decoration: none;
   display: inline-block;
   float: left;
   text-align: center;
}
header a:hover {
   color: #50E3C2;
}
.right-nav ul li {
   font-size: 16px;
   text-decoration: none;
   display: block;
   float: right;
   text-align: center;
   border: 1px solid green;
   margin: 0;
}
.right-nav ul li a{
   height: 20px;
   line-height: 20px;
   padding: 10px;
}
.right-nav>ul>li:first-child a{
   background-color: red;
   font-weight: bold;
}
      </style> 
 </head> 
 <body> 
  <header> 
   <div class="top-nav"> 
    <div id="branding"> 
     <a href="index.html" class="nav-logo"> <img src="https://www.java2s.com/style/demo/Firefox.png" alt="trooops-logo"> </a> 
    </div> 
    <nav class="left-nav"> 
     <ul> 
      <li> <a href="">Discover</a> </li> 
      <li> <a href="">Blog</a> </li> 
     </ul> 
    </nav> 
    <div class="right-nav"> 
     <ul> 
      <li> <a href="">Sign Up</a> </li> 
      <li> <a href="">Log In</a> </li> 
     </ul> 
    </div> 
   </div> 
  </header>  
 </body>
</html>

Related Tutorials