慕課Amy-Tooltip開發(fā)極簡修改版

0x01布局總體預(yù)覽圖

慕課Amy-Tooltip 修改版總體布局預(yù)覽圖

0x02 代碼示例

html布局代碼


<body>

        <div class="nav">
            <ul>
                <li><a href="#" class="tooltip tooltip-effect-1">Home
                    <span class="tooltip-content">
                        <i class="fa fa-home fa-fw" aria-hidden="true"></i></span>
                </a></li>
                <li><a href="#" class="tooltip tooltip-effect-2">About me
                    <span class="tooltip-content">
                        <i class="fa fa-book fa-fw" aria-hidden="true"></i></span>
                </a></li>
                <li><a href="#" class="tooltip tooltip-effect-3">
                    <span class="tooltip-content">
                        <i class="fa fa-camera-retro"></i></span>Potography
                </a></li>
                <li><a href="#" class="tooltip tooltip-effect-4">Work
                    <span class="tooltip-content">
                        <i class="fa fa-book fa-fw" aria-hidden="true"></i></span>
                </a></li>
                <li><a href="#" class="tooltip tooltip-effect-5">Contact
                    <span class="tooltip-content">
                        <i class="fa fa-book fa-fw" aria-hidden="true"></i></span>
                </a></li>
            </ul>
        </div>
    </body>

css樣式代碼


    /*Global style*/
    html{
        width: 100%;
        height: 100%;
        -webkit-text-size-adjust:none;
        -moz-text-size-adjust:none;
        -o-text-size-adjust:none;
        -ms-text-size-adjust:none;
        text-size-adjust:none;

    } 
    
    body{
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        background: #47c9af;
        color: #74777b;
        font-weight:300;
        font-size: 1.5em;
    
    }
     ul{
        list-style: none;
        padding: 0;
        margin: 0;  
     }
     a:link,a:visited,a:focus{
        text-decoration: none;
        outline:none;
     }
    /*
     box-sizing 屬性用于更改用于計(jì)算元素寬度和高度的默認(rèn)的 CSS 盒子模型。可以使用此屬性來模擬不正確支持CSS盒子模型規(guī)范的瀏覽器的行為。
     content-box
    默認(rèn)值,標(biāo)準(zhǔn)盒子模型。 width 與 height 只包括內(nèi)容的寬和高, 不包括邊框(border),內(nèi)邊距(padding),外邊距(margin)。注意: 內(nèi)邊距, 邊框 & 外邊距 都在這個(gè)
    盒子的外部。 比如. 如果 .box {width: 350px}; 而且 {border: 10px solid black;} 那么在瀏覽器中的渲染的實(shí)際寬度將是370px;

    尺寸計(jì)算公式:width = 內(nèi)容的寬度,height = 內(nèi)容的高度。寬度和高度都不包含內(nèi)容的邊框(border)和內(nèi)邊距(padding)。
    border-box
    width 和 height 屬性包括內(nèi)容,內(nèi)邊距和邊框,但不包括外邊距。這是當(dāng)文檔處于 Quirks模式 時(shí)Internet Explorer使用的盒模型。注意,填充和邊框?qū)⒃诤凶觾?nèi) , 
    例如, .box {width: 350px; border: 10px solid black;} 導(dǎo)致在瀏覽器中呈現(xiàn)的寬度為350px的盒子。內(nèi)容框不能為負(fù),并且被分配到0,使得不可能使用border-box
    使元素消失;
    這里的維度計(jì)算為:
    width = border + padding + 內(nèi)容的  width,
    height = border + padding + 內(nèi)容的 height。
    padding-box   
    width 和 height 屬性包括內(nèi)容和內(nèi)邊距,但是不包括邊框和外邊距。只有Firefox實(shí)現(xiàn)了這個(gè)值,它在Firefox 50中被刪除。
     */
     *,*:after,*:before{   /*通配符選擇器*/
        -webkit-box-sizing:border-box;      
        -moz-box-sizing:border-box;
        -ms-box-sizing:border-box;
        -o-box-sizing:border-box;
        box-sizing: border-box;
     }
    *:after,*:before{
        display:inlie-block;
        content:"";
    }
    *:after{clear: both;}
    
    /*Navgaitor style*/
    .nav{
        width: 900px;
        height: 300px;
        margin: 300px auto;
    }
    .nav li{
        display: inline-block;
        margin:0 1em;
        }
    .tooltip{
        position: relative;   /*定位屬性 使元素 按照用戶定義進(jìn)行移動(dòng)  相對定位元素*/
        z-index: 9;
        float: left;
        font-weight: 700;
        color: rgba(0,0,0,0.3);
        padding: 0.15em 0.25em;     
    }
    .tooltip-content {
        position: absolute;   /*定位屬性 使元素 按照用戶定義進(jìn)行移動(dòng)  絕對定位元素*/
        z-index: 10;
        left: 50%;
        width: 80px;
        height: 80px;
        border-radius: 50%;
        background: #fff;
        margin-left:-40px;
        bottom: 100%;
        text-align: center;
        padding-top:25px;
        color:#47c9af;
    }
    .tooltip-content::after{  /*css3 after元素選擇*/
        display: block;
        content: "";
    }
    .tooltip>*{
        opacity: 0;/*css透明度*/
    }
    .tooltip:hover > *{
        opacity: 1; /*css透明度*/
        transition:1s; /*css3過渡動(dòng)畫*/
        transform: rotate(360deg); /*css3旋轉(zhuǎn)動(dòng)畫*/
    }


效果圖


Amy-Tooltip 修改版效果1

Amy-Tooltip 修改版效果2

Amy-Tooltip 修改版效果3
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容

  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 173,024評論 25 708
  • 問答題47 /72 常見瀏覽器兼容性問題與解決方案? 參考答案 (1)瀏覽器兼容問題一:不同瀏覽器的標(biāo)簽?zāi)J(rèn)的外補(bǔ)...
    _Yfling閱讀 13,790評論 1 92
  • 我和樹爸都很喜歡寧靜的鄉(xiāng)村,所以每到周末,總會到附近的鄉(xiāng)村去散步,賞花,看風(fēng)景。 這個(gè)周末終于迎來了明媚的陽光,我...
    苗苗在故鄉(xiāng)閱讀 241評論 2 2
  • 二十一、 余天與陳美兒的較量 自從上次在路邊吵架后,余天一直沒跟青草聯(lián)系,不是不想聯(lián)系,開始是生氣,等著青草來向他...
    安瀾2016閱讀 444評論 0 3
  • 斜體 粗體百度 這里是引用 代碼塊 恩我感覺差不多了...顏色需要用HTML寫 表示太麻煩..
    Ko_Neko閱讀 463評論 0 49