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

效果图如下:

相关推荐
学不会•1 小时前
css数据不固定情况下,循环加不同背景颜色
前端·javascript·html
活宝小娜3 小时前
vue不刷新浏览器更新页面的方法
前端·javascript·vue.js
程序视点3 小时前
【Vue3新工具】Pinia.js:提升开发效率,更轻量、更高效的状态管理方案!
前端·javascript·vue.js·typescript·vue·ecmascript
coldriversnow3 小时前
在Vue中,vue document.onkeydown 无效
前端·javascript·vue.js
我开心就好o3 小时前
uniapp点左上角返回键, 重复来回跳转的问题 解决方案
前端·javascript·uni-app
开心工作室_kaic4 小时前
ssm161基于web的资源共享平台的共享与开发+jsp(论文+源码)_kaic
java·开发语言·前端
刚刚好ā4 小时前
js作用域超全介绍--全局作用域、局部作用、块级作用域
前端·javascript·vue.js·vue
沉默璇年6 小时前
react中useMemo的使用场景
前端·react.js·前端框架
yqcoder6 小时前
reactflow 中 useNodesState 模块作用
开发语言·前端·javascript
2401_882727576 小时前
BY组态-低代码web可视化组件
前端·后端·物联网·低代码·数学建模·前端框架