୧((〃•̀ꇴ•〃))૭⁺✧
2020-08-24 11:32
采纳率: 86.8%
浏览 1.4k

css如何让div中的form表单居中显示?

图片说明

如何让框中居中显示,和下面对齐?

<div class="layui-fluid" id="divcss5">
    <div class="layui-row">
        <form class="layui-form" id=form1 method="post" >
            <input type="hidden" id="userid" name="userid" th:value="${session.id2}">

            <div class="layui-form-item" style="text-align: center">
                <label for="lng" class="layui-form-label">
                    <span class="x-red">*</span>经度:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="lng" name="lng" class="layui-input" required="required">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="lat" class="layui-form-label">
                    <span class="x-red">*</span>纬度:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="lat" name="lat" class="layui-input" required="required">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="facilityname" class="layui-form-label">
                    <span class="x-red">*</span>设备名称:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="facilityname" name="facilityname" class="layui-input" required="required">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="mac" class="layui-form-label">
                    <span class="x-red">*</span>设备码:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="mac" name="mac" class="layui-input" required="required">
                </div>
            </div>


        </form>
        <div class="layui-form-item">
            <button class="layui-btn" lay-filter="add" onclick="huoqu()" lay-submit="">获取经纬度</button>
            <button class="layui-btn" lay-filter="add" onclick="add()" lay-submit="">确定</button>
        </div>
    </div>
</div>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • 代码的灵魂是bug! 2020-08-24 14:12
    已采纳
    <div class="layui-row" style="display:flex;justify-content:center;">
    
    点赞 1 打赏 评论
  • jingluan666 2020-08-24 13:04

    使用margin,第二个用auto

    <div style="width:300px;height:300px;background-color:green;margin:100px auto;">   
    </div>
    
    点赞 打赏 评论
  • dabocaiqq 2020-08-24 14:29
    点赞 打赏 评论

相关推荐 更多相似问题