簡單的特效

改變字型

在這之前,介紹一個字型的網站 https://www.google.com/fonts/

如何使用?

1.加入<link href='字型網址' rel='stylesheet' type='text/css'>

2.font-family: '字型名稱

簡單效果

1.淡入

新增一個HTML檔案,加入

<!DOCTYPE html>
<html>
<head>

    <link href='http://fonts.googleapis.com/css?family=Lato:900' rel='stylesheet' type='text/css'>

    <style type="text/css">

        body > div
        {

            margin:121px 149px;

            width:483px;
            height:298px;

            background:#676470;
            color:#fff;

            font-family:Lato;
            font-weight:900;
            font-size:3.4em;

            text-align:center;
            line-height:298px;

            transition:all 0.3s;

        }

        .fade
        {
            opacity:0.5;
        }
        .fade:hover
        {
            opacity:1;
        }

    </style>
</head>
<body>

    <div class="fade">Fade in</div>

</body>
</html>

2.淡出

3.滑鼠滑入時更改顏色

4.放大

5.縮小

6.旋轉縮小

7.變換外框形狀

8.重疊陰影效果

9.震動效果

10.往內的邊框

11.視差捲動

解說: http://codepen.io/EasonWang01/pen/VaQYmW

perspective為人們看元素的距離(數字越大越近看)

translateZ為Z軸的坐標

scale放大元素

(想像坐在車上時觀看窗外月亮,沒有移動,但窗外樹叢卻移動很快,同樣道理)

Last updated

Was this helpful?