zoukankan      html  css  js  c++  java
  • Creating a Google Like RedBlack Navigation Bar Without Any Image/JavaScript

    So this is my first post on my new Blog, and i am quite exited about it :D , while visiting Google’s homepage, I was wondering about their new Top black navigation bar so I came up with this. If you Google it, you will get plenty of tutorials about creating the new Google like  navigation bar but most of them includes JavaScript/Image or both which slow down the loading time.

    In this post, I am gonna help you create a Google like black colored Top navigation menu only with CSS

    At first, take a look at what we are creating :

    Creating google like navigation menu

    Creating google like navigation menu

    We’re gonna make it by two steps,

    Step 1 : CSS Styling ( See the Comments for CSS details)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    body {
    margin:0 auto;
    }
     
    /*--navigation wrapper--*/
    #navwrapper {
    margin:0 auto;
    background-color#2D2D2D;
    }
     
    #nav {
    font-familyArialHelveticasans-serif;
    font-size:12px;
    padding-top:4px;
    }
     
    #nav, #nav ul {
    padding0;
    margin0;
    list-stylenone;
    font-familyArialHelveticasans-serif;
    }
     
    /*--main nav links style--*/
    #nav a {
    display:block;
    padding:7px 7px 7px 7px;
    color:#ccc;
    text-decoration:none;
    }
     
    #nav a.dmenu {
     
    }
     
    #nav a.dmenu:hover {
    color:#3366CC !important;
    background-color#fff !important;
    }
     
    #nav li {
    floatleft;
    }
     
    #nav li {positionrelative;}
     
    /* hide from IE, mac */
    #nav li {positionstaticwidthauto;}
    /* end hiding from IE5 mac */
     
    /*--drop down menu styling--*/
    #nav li ul {
    positionabsolute;
    displaynone;
    margin-left:-1px;
    padding-bottom:10px;
    background-color#FFFFFF;
    border1px solid #bbb;
    border-top:none;
    -moz-box-shadow: 0 0 5px #ddd;
    -webkit-box-shadow: 0 0 5px #ddd;
    box-shadow: 0 0 5px #ddd;
    /*--make it top of all the elements on page, so that it can be visible--*/
    z-index:5000;
    }
     
    #nav li:hover a, #nav a:focus,
    #nav a:active {
    padding:7px 7px 7px 7px;
    color:#fff;
    background:#444;
    text-decoration:none;
    }
     
    #nav li ul, #nav ul li  {
    width10em;
    }
     
    /*--drop down menu styling is different from main nav, strict rule--*/
    #nav ul li a  {
    color#3366CC !important;
    border-right0;
    }
    #nav ul li a:hover  {
    color:#3366CC !important;
    background-color#eef3fb !important;
    border-right0;
    }
     
    /*--the selected, current item in the navigation menu--*/
    #nav a.current{
    color:#fff;
    font-weight:bold;
    background:#2D2D2D;
    text-decoration:none;
    border-top:2px solid #C33;
    padding-bottom:5px/*--removing 2px border from 7px padding--*/
    }
     
    #nav a.current:hover{
    padding-bottom:5px/*--removing 2px border from 7px padding--*/
    }
     
    #nav li:hover ul {
    displayblock;
    }
     
    #nav li:hover ul a{
    color#000000;
    background-colortransparent;
    }
     
    #nav ul a:hover {
    background-color#606060!important;
    color#FFFFFF !important;
    }
     
    /*--used in drop down menu items--*/
    .menuseprator{border-bottom:1px solid #dddmargin:10px 0 10px 0;}
     
    /*--for showing down arrow in drop down menu item--*/
    .arrowdown{color#eeefont-size:0.5em;}
     
    /*--for the left navigation menu--*/
    .floatleft{float:left;}
     
    /*--for the right options navigation menu--*/
    .floatright{float:right;}
     
    /*--clear all floating, left and right--*/
    .clear{clear:both;} 

    Step 2: HTML markup 

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    <div id="navwrapper">
    <ul class="floatleft" id="nav">
            <li><a href="#">Rabby +</a></li>
            <li><a class="current" href="#">Web</a></li>
            <li><a href="#">Images</a></li>
            <li><a href="#">Video</a></li>
            <li><a href="#">Maps</a></li>
            <li><a href="#">Gmail</a></li>
            <li><a href="#">News</a></li>
            <li><a class="dmenu" href="#">More <span class="arrowdown">▼</span></a>
    <ul>
    <ul>
            <li><a href="#">Translate</a></li>
            <li><a href="#">Books</a></li>
            <li><a href="#">Schoolar</a></li>
            <li><a href="#">Blogs</a></li>
    </ul>
    </ul>
    <ul>
    <ul>
            <li class="menuseprator"></li>
            <li><a href="#">Youtube</a></li>
            <li><a href="#">Calender</a></li>
            <li><a href="#">Photos</a></li>
            <li><a href="#">Documents</a></li>
            <li><a href="#">Sites</a></li>
            <li><a href="#">Groups</a></li>
    </ul>
    </ul>
    <ul>
            <li class="menuseprator"></li>
            <li><a href="#">Even More »</a></li>
    </ul>
    </li>
    </ul>
    <ul class="floatright" id="nav">
            <li><a href="#">rabbybhuiyan@gmail.com</a></li>
            <li><a href="#">Settings</a></li>
            <li><a href="#">Logout</a></li>
    </ul>
    <br class="clear" /></div>

    Voila, Now Copy and paste the HTML code to your HTML file and the CSS to your Style.css file and your are DONE! Cheeck out the live demo Bellow

    Live Demo

    Works on all browsers except IE6


    If you are having any issues with this please Do drop in your Comments , Suggestion and feedback are warmly welcomed

    http://thegeekyme.com/creating-a-google-like-redblack-navigation-bar-without-any-imagejavascript

  • 相关阅读:
    深挖 GIL锁
    numpy小入门
    IPython和Jupyter notebook
    LINUX+Vmware+SVN的配置和安装
    windows下使用火狐浏览器插件AutoProxy+MyEnTunnel+SSH访问海外站点(转)
    无法打开键: UNKNOWNComponentsBE1FB738077DBE490AF18C3B9B1A1EE8E5F5286B58B542741A00A0A9AA420B27
    如何将软件测试和数据库联系在一起(转)
    接口测试第十二课(fidller过滤)(转)
    android、IOS和手机基础知识
    广州女生手机被偷 里面的身份证出卖了支付宝密码丨丢手机后必做6件事(转)
  • 原文地址:https://www.cnblogs.com/yqskj/p/3084600.html
Copyright © 2011-2022 走看看