原生实现前端表单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>

效果图如下:

相关推荐
hackeroink10 分钟前
【2024版】最新推荐好用的XSS漏洞扫描利用工具_xss扫描工具
前端·xss
迷雾漫步者2 小时前
Flutter组件————FloatingActionButton
前端·flutter·dart
向前看-2 小时前
验证码机制
前端·后端
燃先生._.3 小时前
Day-03 Vue(生命周期、生命周期钩子八个函数、工程化开发和脚手架、组件化开发、根组件、局部注册和全局注册的步骤)
前端·javascript·vue.js
高山我梦口香糖4 小时前
[react]searchParams转普通对象
开发语言·前端·javascript
m0_748235244 小时前
前端实现获取后端返回的文件流并下载
前端·状态模式
m0_748240255 小时前
前端如何检测用户登录状态是否过期
前端
black^sugar5 小时前
纯前端实现更新检测
开发语言·前端·javascript
寻找沙漠的人6 小时前
前端知识补充—CSS
前端·css