bootstrap i' m尝试与bootstrap对齐,但没有工作

发布于 2025-02-09 18:28:13 字数 1313 浏览 2 评论 0 原文

我正在尝试与Bootstrap保持一致,但它不起作用。
我不想逐桌做我尝试使用表标签的表,但是我想通过使用Divs和Bootstrap来做到这一点。

如您所见,我不是Bootstrap的专家,但我正在尝试。
谁能帮我吗?

我的屏幕:

“在此处输入图像描述”

这是我的代码:

    <div class="d-flex flex-column">
        <div class="d-flex flex-row justify-content-around">
            <div class="d-flex flex-row">
                Código da filial:
                <input type="text" class="form-control" name="CTD_ITEM">
            </div>
            <div class="d-flex flex-row">
                Nome:
                <input type="text" class="form-control" name="CTD_DESC01">
            </div>
        </div>
        <div class="d-flex flex-row justify-content-around">
            <div class="d-flex flex-row">
                Estado:
                <input type="text" class="form-control" name="CTD_DESC04">
            </div>
            <div class="d-flex flex-row">
                Sigla:
                <input type="text" class="form-control" name="CTD_DESC02">
            </div>
        </div>
    </div>

I'm trying to align divs with bootstrap, but it doesn't work.
I don't want to do it by table I have tried with the table tag, but I want to do it by using divs and bootstrap.

I'm not an expert with bootstrap as you can see, but I'm trying.
Can anyone help me?

My screen:

enter image description here

Here is my code:

    <div class="d-flex flex-column">
        <div class="d-flex flex-row justify-content-around">
            <div class="d-flex flex-row">
                Código da filial:
                <input type="text" class="form-control" name="CTD_ITEM">
            </div>
            <div class="d-flex flex-row">
                Nome:
                <input type="text" class="form-control" name="CTD_DESC01">
            </div>
        </div>
        <div class="d-flex flex-row justify-content-around">
            <div class="d-flex flex-row">
                Estado:
                <input type="text" class="form-control" name="CTD_DESC04">
            </div>
            <div class="d-flex flex-row">
                Sigla:
                <input type="text" class="form-control" name="CTD_DESC02">
            </div>
        </div>
    </div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽心 2025-02-16 18:28:13

您应该使用Bootstrap的网格系统这是Bootstrap的重要功能
这是您的divs的示例:

<html>

<head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
        integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>

<body>
    <div class="container">
        <div class="row">
            <div class="col-6">
                <div class="row">
                    <div class="col-4">
                        Código da filial:
                    </div>
                    <div class="col-8">
                        <input type="text" class="form-control" name="CTD_ITEM">
                    </div>
                </div>
            </div>
            <div class="col-6">
                <div class="row">
                    <div class="col-4">
                        Nome:
                    </div>
                    <div class="col-8">
                        <input type="text" class="form-control" name="CTD_DESC01">
                    </div>
                </div>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-6">
                <div class="row">
                    <div class="col-4">
                        Estado:
                    </div>
                    <div class="col-8">
                        <input type="text" class="form-control" name="CTD_ITEM">
                    </div>
                </div>
            </div>
            <div class="col-6">
                <div class="row">
                    <div class="col-4">
                        Sigla:
                    </div>
                    <div class="col-8">
                        <input type="text" class="form-control" name="CTD_DESC01">
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
        crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
        integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
        crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
        integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
        crossorigin="anonymous"></script>
</body>

</html>

您可以在集装箱div下重复大div以添加更多字段
网格系统的参考:

You should use Grid System of Bootstrap this is a great feature of Bootstrap
and Here is example of your divs:

<html>

<head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
        integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>

<body>
    <div class="container">
        <div class="row">
            <div class="col-6">
                <div class="row">
                    <div class="col-4">
                        Código da filial:
                    </div>
                    <div class="col-8">
                        <input type="text" class="form-control" name="CTD_ITEM">
                    </div>
                </div>
            </div>
            <div class="col-6">
                <div class="row">
                    <div class="col-4">
                        Nome:
                    </div>
                    <div class="col-8">
                        <input type="text" class="form-control" name="CTD_DESC01">
                    </div>
                </div>
            </div>
        </div>
        <div class="row mt-2">
            <div class="col-6">
                <div class="row">
                    <div class="col-4">
                        Estado:
                    </div>
                    <div class="col-8">
                        <input type="text" class="form-control" name="CTD_ITEM">
                    </div>
                </div>
            </div>
            <div class="col-6">
                <div class="row">
                    <div class="col-4">
                        Sigla:
                    </div>
                    <div class="col-8">
                        <input type="text" class="form-control" name="CTD_DESC01">
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
        crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
        integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
        crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
        integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
        crossorigin="anonymous"></script>
</body>

</html>

You can duplication big div under container div to add more fields
Refernce of Grid System: https://getbootstrap.com/docs/5.0/layout/grid/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文