设置弹出层样式

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>弹出层样式</title>


   <style>
   figure {
    width:144px; /*图片盒子宽度*/
    height:153px; /*图片盒子高度*/
    margin:20px 20px; /*图片盒子间距*/
    border:1px solid #666; /*图片边框*/
    position:relative; /*为弹出层提供定位上下文*/
    float:left; /*让图片并排显示*/
}
    img {display:block;} /*去掉图片下方的基线空白*/
    figcaption {
    display:none; /*隐藏弹出层*/
    position:absolute; /*相对于容器(图片)定位*/
    left:74%; top:14px; /*把弹出层放到图片右侧*/
    width:130px; /*弹出层宽度*/
    padding:10px; /*弹出层内边距*/
    background:#f2eaea;
    border:3px solid red;
    border-radius:6px;
    }
    figure:hover figcaption {display:block;z-index:2} /*鼠标悬停在图片上时显示弹出层*/
    figcaption h3 { /*弹出层的内容*/
    font-size:14px;
    color:#666;
    margin-bottom:6px;
    }
    figcaption a { /*弹出层的内容*/
    display:block;
    text-decoration:none;
    font-size:12px;
    color:#000;

    }

 figcaption::after { /*红色三角形的盒子*/
    content:""; /*需要有内容,这里是一个空字符串*/
    position:absolute; /*相对于弹出层定位*/
    border:12px solid;
    border-color:transparent red transparent transparent;
    right:100%; top:17px; /*相对于盒子边框定位三角形*/
    height:0px; width:0px; /*收缩边框创造三角形*/
    }

       </style>
    </head>
    <body>
        <figure>
            <img src="/images/0.jpg" alt="pink heels" />
            <figcaption>
                <h3>Pink Platforms</h3>
                <a href="#">More info</a>
            </figcaption>
        </figure>
        <figure class="click_me">
            <img src="/images/1.jpg" alt="leopard heels" />
            <figcaption>
                <h3>Leopard Platforms</h3>
                <a href="#">More info</a>
            </figcaption>
        </figure>
        <figure class="click_me">
            <img src="/images/2.jpg" alt="red heels" />
            <figcaption>
                <h3>Red Platforms</h3>
                <a href="#">More info</a>
            </figcaption>
        </figure>
    </body>
    </html>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值