原生实现前端表单title两端对齐,value自适应

html 复制代码
<!--
 * @Author: chenzhijie
 * @Date: 2023-06-15 15:54:26
 * @LastEditTime: 2023-06-15 22:48:25
 * @LastEditors: chenzhijie
 * @Description: 
 * @FilePath: \demo\test20230615-2-1.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>test</title>
    <style>
        .label {
            display: flex;
            background-color: antiquewhite;
            width: 300px;
            flex-direction: row;
            position: relative;
            left: 20px;
        }

        .label::before {
            display: flex;
            background: #999;
            content: "";
            position: relative;
            width: 2px;
            left: -14px;
        }

        .one {
            width: 150px;
            display: flex;
            flex-direction: column;
            background-color: antiquewhite;
        }

        .one .item {
            width: 140px;
            display: flex;
            flex-direction: row;
        }

        .one .item .label_1 {
            position: relative;
            width: 100px;
            min-width: 100px;
            text-align: justify;
            text-align-last: justify;
            top: -20px;
        }

        .one .item .label_1::before {
            display: flex;
            background: #999;
            border-radius: 50px;
            content: "";
            height: 20px;
            position: relative;
            top: 50%;
            width: 20px;
            top: 20px;
            left: -25px;
        }

        .one .item .val_1 {
            width: 100px;
            background-color: aquamarine;
            word-wrap: break-word;
        }

        .two {
            flex: 1;
            /* width: 100px; */
            position: relative;
            left: 84px;
            background-color: blueviolet;
        }

        .two .item {
            width: 204px;
            display: flex;
            flex-direction: row;
        }

        .two .item .label_1 {
            position: relative;
            width: 100px;
            min-width: 100px;
            text-align: justify;
            text-align-last: justify;
            top: -20px;
        }

        .two .item .label_1::before {
            display: flex;
            background: #999;
            border-radius: 50px;
            content: "";
            height: 20px;
            position: relative;
            top: 50%;
            width: 20px;
            top: 20px;
            left: -25px;
        }

        .two .item .val_1 {
            width: 100px;
            background-color: aquamarine;
            word-wrap: break-word;
        }
    </style>
</head>


<body>
    <div>
        <div class="label">
            <div class="one">
                <div class="item">
                    <div class="label_1">所属辖区</div>:
                    <div class="val_1">34111111111111111111</div>
                </div>
                <div class="item">
                    <div class="label_1">所属辖区</div>:
                    <div class="val_1">341111111111111</div>
                </div>
                <div class="item">
                    <div class="label_1">辖区</div>:
                    <div class="val_1">3411111111111111111111111111111111111</div>
                </div>
                <div class="item">
                    <div class="label_1">所属辖区</div>:
                    <div class="val_1">344444444444444444444444444444444444444444444444444444</div>
                </div>
            </div>
            <div class="two">
                <div class="item">
                    <div class="label_1">所属辖区</div>:
                    <div class="val_1">34111111111111111111</div>
                </div>
                <div class="item">
                    <div class="label_1">所属辖区</div>:
                    <div class="val_1">341111111111111</div>
                </div>
                <div class="item">
                    <div class="label_1">辖区</div>:
                    <div class="val_1">3411111111111111111111111111111111111</div>
                </div>
                <div class="item">
                    <div class="label_1">所属辖区</div>:
                    <div class="val_1">344444444444444444444444444444444444444444444444444444</div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

效果图如下:

相关推荐
FreeCultureBoy35 分钟前
macOS 命令行 原生挂载 webdav 方法
前端
uhakadotcom1 小时前
Astro 框架:快速构建内容驱动型网站的利器
前端·javascript·面试
uhakadotcom1 小时前
了解Nest.js和Next.js:如何选择合适的框架
前端·javascript·面试
uhakadotcom1 小时前
React与Next.js:基础知识及应用场景
前端·面试·github
uhakadotcom1 小时前
Remix 框架:性能与易用性的完美结合
前端·javascript·面试
uhakadotcom2 小时前
Node.js 包管理器:npm vs pnpm
前端·javascript·面试
LaoZhangAI3 小时前
2025最全GPT-4o图像生成API指南:官方接口配置+15个实用提示词【保姆级教程】
前端
ONE_Gua3 小时前
chromium魔改——CDP(Chrome DevTools Protocol)检测01
前端·后端·爬虫
LaoZhangAI3 小时前
2025最全Cherry Studio使用MCP指南:8种强大工具配置方法与实战案例
前端
咖啡教室3 小时前
前端开发日常工作每日记录笔记(2019至2024合集)
前端·javascript