HTML纯代码给网页增加右下角提示框弹窗提示图片+文字纯HTML代码无需插件

以下是关闭按钮在右上角的代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 设置提醒框的整体样式 */
        .notification {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background-color: #f8f9fa;
            padding: 16px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        /* 设置图片样式 */
        .notification img {
            width: 40px;
            height: 40px;
            margin-right: 16px;
        }
        /* 设置文字样式 */
        .notification p {
            color: #444;
            line-height: 24px;
        }
        /* 设置关闭按钮的样式 */
        .notification .closeButton {
            position: absolute;
            top: 0;
            right: 0;
            padding: 8px 12px;
            background-color: #ccc;
            color: #fff;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <!-- 提醒框内容 -->
    <div class="notification">
        <img src="https://v2.api-m.com/api/head?return=302" alt="提醒图片">
        <p>欢迎访问宋佳乐博客,希望您在这里玩的开心玩的高兴</p>
        <!-- 关闭按钮 -->
        <button class="closeButton">×</button>
    </div>
    <script>
        // 获取提醒框的 DOM 元素
        const notification = document.querySelector('.notification');
        // 获取关闭按钮的 DOM 元素
        const closeButton = document.querySelector('.notification .closeButton');
        // 添加点击事件监听器
        closeButton.addEventListener('click', () => {
            // 隐藏提醒框
            notification.style.display = 'none';
        });
    </script>
</body>
</html>


关闭按钮在右下角的代码:


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 设置提醒框的整体样式 */
        .notification {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background-color: #f8f9fa;
            padding: 16px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        /* 设置图片样式 */
        .notification img {
            width: 40px;
            height: 40px;
            margin-right: 16px;
        }
        /* 设置文字样式 */
        .notification p {
            color: #444;
            line-height: 24px;
        }
        /* 设置关闭按钮的样式 */
        .notification .closeButton {
            position: absolute;
            bottom: 0;
            right: 0;
            padding: 8px 12px;
            background-color: #ccc;
            color: #fff;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <!-- 提醒框内容 -->
    <div class="notification">
        <img src="https://v2.api-m.com/api/head?return=302" alt="提醒图片">
        <p>您已进入网站内部页面,请勿相信各种广告链接,请不要在本站输入任何账号密码!!!</p>
        <!-- 关闭按钮 -->
        <button class="closeButton">×</button>
    </div>
    <script>
        // 获取提醒框的 DOM 元素
        const notification = document.querySelector('.notification');
        // 获取关闭按钮的 DOM 元素
        const closeButton = document.querySelector('.notification .closeButton');
        // 添加点击事件监听器
        closeButton.addEventListener('click', () => {
            // 隐藏提醒框
            notification.style.display = 'none';
        });
    </script>
</body>
</html>

97 ° 来自:iPhone IANA保留地址
上一篇: 免费良心软件整理,提升你的工作效率
下一篇: 给你的网页增加上各种社交平台(QQ空间/人人网/微博等)分享按钮
您可能还喜欢这些:
版权声明 1 本网站名称:宋佳乐博客
2 本站永久网址:www.songjiale.com
3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长 QQ2801910651进行删除处理。
4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
5 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6 本站资源大都存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
7 如无特别声明本文即为原创文章仅代表个人观点,版权归《宋佳乐博客》所有,欢迎转载,转载请保留原文链接。
8 如果您想第一时间收到本博最新文章可微信搜索公众号《佳乐博客》关注公众号第一时间获取最新消息。
广告位联系QQ2801910651 广告位联系QQ2801910651丨或者在线留言留下您的联系方式我们客服主动与您联系! Document
提醒图片

您已进入网站内部页面,请勿相信各种广告链接,请不要在本站输入任何账号密码!!!

亲,沙发正空着,还不快来抢?

评论审核已开启 记住我的个人信息 回复后邮件通知我
Back to Top