Tuesday, December 10, 2013

SharePoint 2013 new Menu bar - Using Script Editor CSS HTML




(1) Create a new sharepoint 2013 web page
(2) Add a script editor web part
(3) Insert the code below in the Script Editor
(4) Using F12 - IE Developer Toolbar identify the right DIV,UL,LI tags and change corresponding styles below.

Reference: http://www.mrc-productivity.com/techblog/?p=1049
Thanks to Steve.



<div id="wrap">
    <ul class="navbar">
    <li><a href="#">Home</a></li>
    <li><a href="#">Menu Item 2</a>
    <ul>
       <li><a href="#">2a</a></li>
       <li><a href="#">2b</a></li>
    </ul>        
    </li>
    <li><a href="#">Menu Item 3</a>
    <ul>
       <li><a href="#" >3a</a></li>
    </ul>        
    </li>
    <li><a href="#">Menu Item 4</a>
    <ul>
       <li><a href="#">4a</a></li>
       <li><a href="#">4b</a></li>
       <li><a href="#">4c</a></li>
    </ul>        
    </li>
    </ul>
</div>
<style>
#wrap {
 width: 100%; /* Spans the width of the page */
 height: 40px;
 margin: 0; /* Ensures there is no space between sides of the screen and the menu */
 z-index: 99; /* Makes sure that your menu remains on top of other page elements */
 position: relative;
 /*background-color: #366b82;*/
 }
.navbar {
 height: 40px;
        padding: 0;
 margin: 0;
 position: absolute; /* Ensures that the menu doesn’t affect other elements */
 border-right: 1px solid #54879d;
 }
.navbar li  {
   height: auto;
   width: 150px;  /* Each menu item is 150px wide */
   float: left;  /* This lines up the menu items horizontally */
   text-align: center;  /* All text is placed in the center of the box */
   list-style: none;  /* Removes the default styling (bullets) for the list */
   font: normal bold 12px/1.2em Arial, Verdana, Helvetica; 
   padding: 0;
   margin: 0;
   background-color: #FFA000;
                        }

.navbar a {    
  padding: 18px 0;  /* Adds a padding on the top and bottom so the text appears centered vertically */
  border-left: 1px solid #54879d; /* Creates a border in a slightly lighter shade of blue than the background.  Combined with the right border, this creates a nice effect. */
  border-right: 1px solid #1f5065; /* Creates a border in a slightly darker shade of blue than the background.  Combined with the left border, this creates a nice effect. */
  text-decoration: none;  /* Removes the default hyperlink styling. */
  color: white; /* Text color is white */
  display: block;
  }
.navbar li:hover, a:hover {background-color: #0023a0;}  /*54879d; light blue - #667BC6 */

.navbar li ul  {
  display: none;  /* Hides the drop-down menu */
  height: auto;      
  margin: 0; /* Aligns drop-down box underneath the menu item */
  padding: 0; /* Aligns drop-down box underneath the menu item */
  } 

.navbar li:hover ul  {
                        display: block; /* Displays the drop-down box when the menu item is hovered over */
                        }

.navbar li ul li {background-color: #0023a0;}   /*54879d */

.navbar li ul li a  {
  border-left: 1px solid #1f5065;
  border-right: 1px solid #1f5065;
  border-top: 1px solid #74a3b7;
  border-bottom: 1px solid #1f5065;
  }
 
.navbar li ul li a:hover {
  background-color: #667BC6;
  }   /*366b82;   light blue - #667BC6 */
</style>

No comments: