HTML+CSS手写科技感六边形

最近有个需求需要实现一堆这种五颜六色的六边形作为气泡容器,于是就参考网上的思路写了一个这样的六边形。
效果图如下:
在这里插入图片描述

<!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>
        body {
            background-color: black;
        }

        .rect_container_qipao {
            margin: 50px auto;
            transform: rotateZ(270deg);
        }

        .rect_container_qipao,
        .h_c_rect_container,
        .h_c_rect_c_middler,
        .h_c_rect_c_item,
        .border_six_one,
        .border_six_two {
            width: 250px;
            height: 200px;
        }

        .h_c_rect_container,
        .h_c_rect_c_middler,
        .h_c_rect_c_item {
            overflow: hidden;
        }

        /* 这里的高度需要降低一些,让边框可以看到 */
        .border_six_one,
        .border_six_two {
            height: 198px;
        }

        .h_c_rect_container,
        .h_c_rect_c_middler {
            visibility: hidden;
        }

        .rect_container_qipao .h_c_rect_container {
            margin-left: 10px;
            float: left;
            transform: rotate(120deg);
        }

        .h_c_rect_container .h_c_rect_c_middler {
            transform: rotate(-60deg);
        }

        .h_c_rect_c_item,
        .border_six_one,
        .border_six_two {
            box-shadow: 0px 0px 17px 2px rgba(51, 238, 63, 0.6) inset;
            border: 1px solid rgba(51, 238, 63, 1);
        }

        .h_c_rect_c_item {
            position: relative;
            transform: rotate(-60deg);
            background: no-repeat 50% center;
            background-size: 125% auto;
            visibility: visible;
        }

        .border_six_one {
            position: absolute;
            left: 0;
            top: 0;
            transform: rotateZ(60deg);
        }

        .border_six_two {
            position: absolute;
            left: 0;
            top: -3px;
            transform: rotateZ(120deg);
        }

        .rect_text {
            display: flex;
            flex-direction: column;
            position: absolute;
            left: -20%;
            top: -14%;
            width: 200px;
            height: 250px;
            transform: rotateZ(90deg);
            color: #fff;
            text-align: center;
            font-size: 12px;
        }
    </style>
</head>

<body>
    <div class="rect_container_qipao">
        <div class="h_c_rect_container">
            <div class="h_c_rect_c_middler">
                <div class="h_c_rect_c_item">
                    <div class="border_six_one"></div>
                    <div class="border_six_two"></div>
                    <div class="rect_text">
                        <!-- 展示的内容 -->
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>
  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于创建具有科技的登录和注册页面,可以使用HTMLCSS和JavaScript来实现。以下是一个简单的示例: 首先,创建一个HTML文件,并命名为index.html: ```html <!DOCTYPE html> <html> <head> <title>科技登录注册</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="container"> <form id="login-form"> <h2>登录</h2> <input type="text" placeholder="用户名" required> <input type="password" placeholder="密码" required> <button type="submit">登录</button> </form> <form id="register-form"> <h2>注册</h2> <input type="text" placeholder="用户名" required> <input type="email" placeholder="邮箱" required> <input type="password" placeholder="密码" required> <button type="submit">注册</button> </form> </div> <script src="script.js"></script> </body> </html> ``` 接下来,在同一目录下创建一个名为style.cssCSS文件,并添加以下样式: ```css body { font-family: Arial, sans-serif; } .container { display: flex; justify-content: center; align-items: center; height: 100vh; } form { background-color: #f1f1f1; border-radius: 6px; padding: 20px; width: 300px; } h2 { text-align: center; } input[type="text"], input[type="password"], input[type="email"] { width: 100%; padding: 12px 20px; margin: 8px 0; display: inline-block; border: 1px solid #ccc; box-sizing: border-box; } button { background-color: #4CAF50; color: white; padding: 14px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; } button:hover { opacity: 0.8; } ``` 最后,在同一目录下创建一个名为script.js的JavaScript文件,并添加以下代码: ```javascript document.getElementById("login-form").addEventListener("submit", function(e) { e.preventDefault(); // 处理登录逻辑 }); document.getElementById("register-form").addEventListener("submit", function(e) { e.preventDefault(); // 处理注册逻辑 }); ``` 这个示例提供了一个简单的登录和注册表单,使用CSS添加了科技的样式。你可以根据需要进行修改和扩展,以实现更复杂的功能和更炫酷的外观效果。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值