HTML & CSS 制作图片上鼠标滑过热点或者产品部件指定功能说明 id1076-网页前端设计

23 篇文章 0 订阅
12 篇文章 0 订阅

HTML & CSS 制作图片上鼠标滑过热点或者产品部件指定功能说明 id1076-网页前端设计
在这里插入图片描述

源码下载地址

在新演示地址

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <img src="image.jpg" alt="">
        <div class="hotspot watch" text="watch"></div>
        <div class="hotspot laptop" text="laptop"></div>
        <div class="hotspot mouse" text="mouse"></div>
        <div class="hotspot vase" text="grass vase"></div>
    </div>
</body>
</html>

css

body{
    margin: 0;
    padding: 0;
    font-family: "Open Sans";
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container{
    width: 100%;
    max-width: 1200px;
    position: relative;
}

.container img{
    width: 100%;
}

.hotspot{
    width: 20px;
    height: 20px;
    background-color: #9acd32;
    border-radius: 50%;
    position: absolute;
    animation: wave 1s infinite;
    cursor: pointer;
}

.watch{
    left: 12%;
    bottom: 24%;
}

.laptop{
    left: 40%;
    top: 40%;
}

.mouse{
    right: 10%;
    bottom: 22%;
}

.vase{
    right: 18%;
    bottom: 50%;
}

@keyframes wave{
    from{
        box-shadow: 0 0 0 0 #9acd32bb;
    }
    to{
        box-shadow: 0 0 0 10px #9acd3210;
    }
}

.hotspot::before{
    content: attr(text);
    width: max-content;
    position: absolute;
    background-color: #222222dd;
    color: #fff;
    left: 50%;
    transform: translateX(-50%);
    top: 30px;
    padding: 8px 20px;
    font-size: 14px;
    border-radius: 3px;
    display: none;
}

.hotspot::after{
    content: "";
    border-color: transparent transparent #222222dd;
    border-width: 0 8px 6px;
    border-style: solid;
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}

.hotspot:hover::before,
.hotspot:hover::after{
    display: block;
}

源码下载地址

在新演示地址

点赞 评论 转发就是对up的最大支持和鼓励, 非常谢谢!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值