<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    秋風的蕭瑟 又見湖邊木葉飛

    歡迎來到梁良 | LonBlog,這里記錄下了我生活點點滴滴。

    使用css3仿造window7的開始菜單

    相當逼真,css3果然強悍。

    友情提示:請勿在IE下瀏覽。

    查看實例:http://www.jankoatwarpspeed.com/examples/windows7menu/

    點擊下載:http://www.36ria.com/wp-content/plugins/download-monitor/download.php?id=170

    來看下原作者的設計草圖:

    簡明創建過程

    第一步 :創建如下菜單結構

    <div id="startmenu">
    <ul id="programs">
    <li><href="#"><img src="firefox-32.png" alt="" />Mozilla Firefoxa>li>
    <li><href="#"><img src="chrome.png" alt="" />Google Chromea>li>
    <li><href="#"><img src="safari.png" alt="" />Safaria>li>
    <li><href="#"><img src="opera.png" alt="" />Operaa>li>
    <li><href="#"><img src="ie.png" alt="" />Internet Explorera>li>
    <li><href="#"><img src="rss_32.png" alt="" />RSS Feedsa>li>
    <li><href="#"><img src="twitter_32.png" alt="" />Twittera>li>
    <li><href="#"><img src="delicious_32.png" alt="" />Deliciousa>li>
    ul>
    <ul id="links">
    <li class="icon"><img src="folder.png" alt="" />li>
    <li><href="#"><span>Documentsspan>a>li>
    <li><href="#"><span>Picturesspan>a>li>
    <li><href="#"><span>Musicspan>a>li>
    <li><href="#"><span>Computerspan>a>li>
    <li><href="#"><span>Networkspan>a>li>
    <li><href="#"><span>Connect tospan>a>li>
    ul>
    div>

    win7的開始菜單有二個部分,左側程序菜單,右側系統菜單。

    第二步:菜單容器css

    #startmenu { border:solid 1px #102a3e; overflow:visible; display:inline-block; margin:60px 0 0 20px;
                         -moz-border-radius:5px;-webkit-border-radius:5px; position:relative;
    box-shadow: inset 0 0 1px #fff; -moz-box-shadow: inset 0 0 1px #fff; -webkit-box-shadow: inset 0 0 1px #fff;
    background-color:#619bb9;
    background: -moz-linear-gradient(top, rgba(50, 123, 165, 0.75), rgba(46, 75, 90, 0.75) 50%, rgba(92, 176, 220, 0.75));
    background: -webkit-gradient(linear, center top, center bottom, from(#327aa4),color-stop(45%, #2e4b5a), to(#5cb0dc)); }

    有幾個關注的點,可以留意下:

    • -moz-border-radius:5px;-webkit-border-radius:5px;圓角效果,這是css3中應用最廣的
    • box-shadow: inset 0 0 1px #fff; -moz-box-shadow: inset 0 0 1px #fff; -webkit-box-shadow: inset 0 0 1px #fff;陰影效果
    • background: -moz-linear-gradient(top, rgba(50, 123, 165, 0.75), rgba(46, 75, 90, 0.75) 50%, rgba(92, 176, 220, 0.75));漸變背景

    第三步:菜單左側部分的css

    #programs { background:#fff; border:solid 1px #365167; margin:7px 0 7px 7px;
    box-shadow: 0 0 1px #fff; -moz-box-shadow: 0 0 1px #fff; -webkit-box-shadow: 0 0 1px #fff;
                        -moz-border-radius:3px;-webkit-border-radius:3px;}
    #programs a { border:solid 1px transparent; display:block; padding:3px; margin:3px;
    color:#4b4b4b; text-decoration:none; min-width:220px;}
    #programs a:hover {border:solid 1px #7da2ce;
                         -moz-border-radius:3px; -webkit-border-radius:3px;
    box-shadow: inset 0 0 1px #fff; -moz-box-shadow: inset 0 0 1px #fff; -webkit-box-shadow: inset 0 0 1px #fff;
    background-color:#cfe3fd;
    background: -moz-linear-gradient(top, #dcebfd, #c2dcfd);
    background: -webkit-gradient(linear, center top, center bottom, from(#dcebfd), to(#c2dcfd));}
    #programs a img {border:0; vertical-align:middle; margin:0 5px 0 0;}

    這里值得留意的是鼠標經過菜單項的效果設置,也就是#programs a:hover里的樣式,這是難點,也是css3的強大之處,依舊是圓角、陰影、漸變背景。

    第四步:菜單右側的CSS部分

    #links {margin:7px; margin-top:-30px;}
    #links li.icon {text-align:center;}
    #links a {border:solid 1px transparent; display:block; margin:5px 0; position:relative;
    color:#fff; text-decoration:none; min-width:120px;}
    #links a:hover {border:solid 1px #000;
                          -moz-border-radius:3px; -webkit-border-radius:3px;
     box-shadow: 0 0 1px #fff; -moz-box-shadow: inset 0 0 1px #fff; -webkit-box-shadow: inset 0 0 1px #fff;
     background-color:#658da0;
     background: -moz-linear-gradient(center left, rgba(81,115,132,0.55), rgba(121,163,184,0.55) 50%, rgba(81,115,132,0.55));
     background: -webkit-gradient(linear, 0% 100%, 100% 100%, from(#517384), color-stop(50%, #79a3b8), to(#517384));
     
    }
     #links a span { padding:5px; display:block; }
     #links a:hover span { background: -moz-linear-gradient(center top, transparent, transparent 49%, rgba(2,37,58,0.5) 50%, rgba(63,111,135,0.5));
     background: -webkit-gradient(linear, center top, center bottom, from(transparent), color-stop(49%, transparent),
                                    color-stop(50%, rgba(2,37,58,0.5)), to(rgba(63,111,135,0.5))); }

    要留意的點依舊是哪幾項,難點在于細節的微調,尤其是漸變背景的制作,css3中非常靈活,下次有機會,發篇css3漸變背景的詳細教程。
    英文原文:http://www.jankoatwarpspeed.com/post/2010/04/06/windows-7-start-menu-css3.aspx

    posted on 2010-06-08 10:38 梁良 閱讀(255) 評論(0)  編輯  收藏 所屬分類: CSS

    <2010年6月>
    303112345
    6789101112
    13141516171819
    20212223242526
    27282930123
    45678910

    導航

    公告

        歡迎光臨

    常用鏈接

    隨筆分類

    隨筆檔案

    相冊

    .我的網站.

    友情博客

    開源社區

    科技博客

    資料網站

    最新隨筆

    搜索

    最新評論

    閱讀排行榜

    Powered by:
    LonLeung
    Copyright © 梁良

    本頁生成時間:毫秒

    主站蜘蛛池模板: 亚洲欧美成aⅴ人在线观看| 亚洲?V乱码久久精品蜜桃| 久久A级毛片免费观看| 中文字幕免费在线看线人动作大片 | a毛片免费播放全部完整| www一区二区www免费| 一个人看的www视频免费在线观看| 国产尤物在线视精品在亚洲| 国产午夜亚洲精品不卡| 黄色毛片视频免费| 国产精品免费久久| 成人性生交大片免费看中文| 亚洲an日韩专区在线| 亚洲AV无码乱码国产麻豆穿越 | AV免费网址在线观看| 性感美女视频在线观看免费精品| 成人在线视频免费| 四虎永久免费影院在线| 2022中文字字幕久亚洲| 亚洲av伊人久久综合密臀性色| 亚洲男人第一av网站| 91亚洲精品麻豆| 亚洲欧美熟妇综合久久久久 | 777亚洲精品乱码久久久久久 | 亚洲精品国产摄像头| 污网站在线免费观看| caoporn成人免费公开| 久爱免费观看在线网站| 中文字幕无码成人免费视频| 热99re久久免费视精品频软件| 亚洲精品国产日韩无码AV永久免费网| 国产亚洲精品不卡在线| 中文字幕亚洲综合久久| 亚洲综合一区国产精品| japanese色国产在线看免费| 久久99精品国产免费观看| 女人18特级一级毛片免费视频| 亚洲国产婷婷综合在线精品| 亚洲一区二区电影| 亚洲精品无码成人片久久不卡| 国产免费久久精品丫丫|