码迷,mamicode.com
首页 > Web开发 > 详细

Css Study - 横向MENU

时间:2014-08-06 18:21:41      阅读:420      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   for   art   

http://cssmenumaker.com/menu/tabbed-chrome-and-blue

 

HTML

bubuko.com,布布扣
<div id="topMenu">
            <ul>
                <li><a href="#">Home</a></li>
                <li><a href="#">PRODUCTS</a></li>
                <li><a href="#">Contact</a></li>
                <li><a href="#">Messages</a></li>
                <li><a href="#">Lists</a></li>
                <li><a href="#">Admin</a></li>
            </ul>
        </div>
View Code

 

CSS

 

bubuko.com,布布扣
<style>
        #topMenu {
            height: 30px;
            width: 100%;
            border-bottom: solid 2px #4cb6ea;
            text-align: right;
        }

            #topMenu ul {
                position: absolute;
                right: 30px;
                height: 30px;
                line-height: 30px;
            }

            #topMenu a {
                font-size: 16px;
                font-weight: bold;
                padding: 5px 15px 8px 15px;
                border-top: solid 2px #4cb6ea;
                border-left: solid 2px #4cb6ea;
                border-right: solid 2px #4cb6ea;
                border-top-left-radius: 5px;
                border-top-right-radius: 5px;
                background-color: #4cb6ea;
                color: #fff;
            }

                #topMenu a:hover {
                    color: #666;
                    text-decoration: none;
                    background-color: #fff;
                }
    </style>
View Code

 

 

dropdown menu

HTML

bubuko.com,布布扣
<div class="fr" id="topbanner">
                <ul>
                    <li class=has-sub><a href="#">Contact Us</a>
                        <ul>
                            <li><a href="#">Send Email</a></li>
                            <li><a href="#">Call Me</a></li>
                        </ul>
                    </li>
                    <li><a href="#">My Category</a></li>
                </ul>
            </div>
View Code

 

CSS

bubuko.com,布布扣
<style>
        #topbanner ul {
            list-style: none;
            margin: 0;
            padding: 0;
            display: block;
        }

            #topbanner ul:after,
            #topbanner:after {
                content: " ";
                display: block;
                font-size: 0;
                height: 0;
                clear: both;
                visibility: hidden;
            }

            #topbanner ul li {
                margin: 0;
                padding: 0;
                display: block;
                position: relative;
            }

                #topbanner ul li a {
                    text-decoration: none;
                    display: block;
                    margin: 0;
                    -webkit-transition: color .2s ease;
                    -moz-transition: color .2s ease;
                    -ms-transition: color .2s ease;
                    -o-transition: color .2s ease;
                    transition: color .2s ease;
                    -webkit-box-sizing: border-box;
                    -moz-box-sizing: border-box;
                    box-sizing: border-box;
                }

                #topbanner ul li ul {
                    position: absolute;
                    left: -9999px;
                    top: auto;
                }

                    #topbanner ul li ul li {
                        max-height: 0;
                        position: absolute;
                        -webkit-transition: max-height 0.4s ease-out;
                        -moz-transition: max-height 0.4s ease-out;
                        -ms-transition: max-height 0.4s ease-out;
                        -o-transition: max-height 0.4s ease-out;
                        transition: max-height 0.4s ease-out;
                        background: #ffffff;
                    }

                        #topbanner ul li ul li.has-sub:after {
                            display: block;
                            position: absolute;
                            content: "";
                            height: 10px;
                            width: 10px;
                            border-radius: 5px;
                            background: #000000;
                            z-index: 1;
                            top: 3px;
                            right: 15px;
                        }

                        #topbanner ul li ul li.has-sub:before {
                            display: block;
                            position: absolute;
                            content: "";
                            height: 0;
                            width: 0;
                            border: 3px solid transparent;
                            border-left-color: #ffffff;
                            z-index: 2;
                            top: 5px;
                            right: 15px;
                        }

                        #topbanner ul li ul li a {
                            font-size: 14px;
                            text-transform: none;
                            color: #000000;
                            letter-spacing: 0;
                            display: block;
                            width: 120px;
                            padding: 0px 10px 0px 10px;
                        }

                        #topbanner ul li ul li:hover > a,
                        #topbanner ul li ul li.active > a {
                            color: #4cb6ea;
                        }

                        #topbanner ul li ul li:hover:after,
                        #topbanner ul li ul li.active:after {
                            background: #4cb6ea;
                        }

                        #topbanner ul li ul li:hover > ul {
                            left: 100%;
                            top: 0;
                        }

                            #topbanner ul li ul li:hover > ul > li {
                                max-height: 30px;
                                position: relative;
                            }

        #topbanner > ul > li {
            float: left;
        }

            #topbanner > ul > li:after {
                content: "";
                display: block;
                position: absolute;
                width: 100%;
                height: 0;
                top: 0;
                z-index: 0;
                background: #ffffff;
                -webkit-transition: height .2s;
                -moz-transition: height .2s;
                -ms-transition: height .2s;
                -o-transition: height .2s;
                transition: height .2s;
            }

            #topbanner > ul > li.has-sub > a {
                padding-right: 35px;
            }

                #topbanner > ul > li.has-sub > a:after {
                    display: block;
                    content: "";
                    background: #ffffff;
                    height: 12px;
                    width: 12px;
                    position: absolute;
                    border-radius: 13px;
                    right: 14px;
                    top: 10px;
                }

                #topbanner > ul > li.has-sub > a:before {
                    display: block;
                    content: "";
                    border: 4px solid transparent;
                    border-top-color: #4cb6ea;
                    z-index: 2;
                    height: 0;
                    width: 0;
                    position: absolute;
                    right: 16px;
                    top: 15px;
                }

            #topbanner > ul > li > a {
                color: #666;
                padding: 0px 5px 0px 10px;
                font-weight: 600;
                letter-spacing: 1px;
                text-transform: uppercase;
                font-size: 14px;
                z-index: 2;
                position: relative;
            }

            #topbanner > ul > li:hover:after,
            #topbanner > ul > li.active:after {
                height: 100%;
            }

            #topbanner > ul > li:hover > a,
            #topbanner > ul > li.active > a {
                color: #000000;
            }

                #topbanner > ul > li:hover > a:after,
                #topbanner > ul > li.active > a:after {
                    background: #000000;
                }

                #topbanner > ul > li:hover > a:before,
                #topbanner > ul > li.active > a:before {
                    border-top-color: #ffffff;
                }

            #topbanner > ul > li:hover > ul {
                left: 0;
            }

                #topbanner > ul > li:hover > ul > li {
                    max-height: 72px;
                    position: relative;
                }

            #topbanner > ul > li > a {
                display: block;
            }

        #topbanner > ul > li {
            width: auto;
        }

            #topbanner > ul > li > ul {
                width: 170px;
                display: block;
            }

                #topbanner > ul > li > ul > li {
                    width: 170px;
                    display: block;
                }

        @media all and (max-width: 800px), only screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 1024px), only screen and (min--moz-device-pixel-ratio: 2) and (max-width: 1024px), only screen and (-o-min-device-pixel-ratio: 2/1) and (max-width: 1024px), only screen and (min-device-pixel-ratio: 2) and (max-width: 1024px), only screen and (min-resolution: 192dpi) and (max-width: 1024px), only screen and (min-resolution: 2dppx) and (max-width: 1024px) {
            #topbanner > ul {
                max-height: 0;
                overflow: hidden;
                -webkit-transition: max-height 0.35s ease-out;
                -moz-transition: max-height 0.35s ease-out;
                -ms-transition: max-height 0.35s ease-out;
                -o-transition: max-height 0.35s ease-out;
                transition: max-height 0.35s ease-out;
            }

                #topbanner > ul > li > ul {
                    width: 100%;
                    display: block;
                }

                    #topbanner > ul > li > ul > li {
                        width: 100%;
                        display: block;
                    }

                        #topbanner > ul > li > ul > li > a {
                            width: 100%;
                            display: block;
                        }

            #topbanner ul li ul li a {
                width: 100%;
            }

            #topbanner ul {
                width: 100%;
            }

                #topbanner ul > li {
                    float: none;
                    width: 100%;
                }

                #topbanner ul li a {
                    -webkit-box-sizing: border-box;
                    -moz-box-sizing: border-box;
                    box-sizing: border-box;
                    width: 100%;
                    padding: 12px 20px;
                }

                #topbanner ul > li:after {
                    display: none;
                }

                #topbanner ul li.has-sub > a:after,
                #topbanner ul li.has-sub > a:before,
                #topbanner ul li ul li.has-sub:after,
                #topbanner ul li ul li.has-sub:before {
                    display: none;
                }

                #topbanner ul li ul,
                #topbanner ul li ul li ul,
                #topbanner ul li ul li:hover > ul,
                #topbanner.align-right ul li ul,
                #topbanner.align-right ul li ul li ul,
                #topbanner.align-right ul li ul li:hover > ul {
                    left: 0;
                    position: relative;
                    right: auto;
                }

                    #topbanner ul li ul li,
                    #topbanner ul li:hover > ul > li {
                        max-height: 999px;
                        position: relative;
                        background: none;
                    }

                        #topbanner ul li ul li a {
                            padding: 8px 20px 8px 35px;
                            color: #ffffff;
                        }

                        #topbanner ul li ul li:hover > a {
                            color: #000000;
                        }
        }
    </style>
View Code

 

Css Study - 横向MENU,布布扣,bubuko.com

Css Study - 横向MENU

标签:style   blog   http   color   os   io   for   art   

原文地址:http://www.cnblogs.com/rebecca-ty/p/3894720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!