css (transition) 过渡

2021-09-10  本文已影响0人  xueyueshuai
<!DOCTYPE html>
<html>

<head>
    <style>
        div {
            width: 100px;
            height: 100px;
            background: blue;
            transition: width 2s; /*transition: all 2s*/
        }

        div:hover {
            width: 300px;
        }
    </style>
</head>

<body>

    <div></div>

    <p>请把鼠标指针移动到蓝色的 div 元素上,就可以看到过渡效果。</p>

    <p><b>注释:</b>本例在 Internet Explorer 中无效。</p>

</body>

</html>

上一篇 下一篇

猜你喜欢

热点阅读