插图专用标签,隐藏,定位,移动,透明

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        /*  给整个父级 设置宽高, 超出部分隐藏 */
        figure{
            position:relative;
            width: 400px;
            height: 250px;
            overflow: hidden;
        }

        /*  将标题 定位 到图片  */
        figcaption{
            position:absolute;
            top:0;
            left:20px;
            color:red;
            font-family:黑体;
        }

        /*  给标题文字 设置 默认位置  */
        figcaption p{
            color:black;
            background-color: #fff;
            padding:4px;
            font-family:微软雅黑;
            transform: translate(-100px,0);
            transition:all .3s;
        }


        /* 给标题指定的p 延迟出现  */
        figcaption p:nth-of-type(1){
            transition-delay:0.05s;
        }
        figcaption p:nth-of-type(2){
            transition-delay:0.1s;
        }
        figcaption p:nth-of-type(3){
            transition-delay:0.15s;
        }


        
        figure:hover figcaption p{
            transform: translate(0,0);
        }

        figure img{
            transition:all .3s;
        }

        figure:hover img{
            transform: translate(-30px,0);
            opacity: 0.8;
        }



    </style>
</head>
<body>
    <!-- 
        figure   插图标签(图像, 图表)  语义化标签
            专门用于规定独立的流内容(图像, 图标, 照片 ...)

        figcaption   插图标题
            与 figure 配套使用
            用于标签定义figure元素的标题
     -->

     <figure>
        <img src="a2.jpg" alt="">
        <figcaption>
            <h2> 热狗 </h2>
            <p> 我帅不帅</p>
            <p> 我靓不靓</p>
            <p> 我叼不刁</p>
        </figcaption>
     </figure>
</body>
</html>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容