我想在不使用 flex 和 grid 的情况下将多列创建为两列布局

发布于 2025-01-12 16:38:24 字数 324 浏览 1 评论 0原文

我需要在不使用 Flex 和网格的情况下将多列创建为两列布局。因为我在 laravel 中使用 dompdf 插件。 dompdf 不支持 grid 和 flex。因为它不支持css v3。请给出css2的布局设计(没有flex和grid)。我不喜欢表格格式,因为两列布局可能有也可能没有相同的高度。这就是为什么它必须调整高度和下一个 div 占用的空白空间的原因。谢谢。 输入图片此处描述

I need to create multiple columns into two column layout without using flex and grid. because im using dompdf plugin in laravel. dompdf doesn't support grid and flex. because it doesn't support css v3.Please give a layout design in css2(without flex and grid).I don't prefer table format, because the two column layout may or may not have the same height. thats why it has to resize the height and the empty space occupied by the next div.Thanks. enter image description here

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

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

发布评论

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

评论(2

新一帅帅 2025-01-19 16:38:24
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
</head>
<style type="text/css">
    *{
        outline: none;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    .area{
        width: 100%;
        height: auto;
    }
    .container{
        max-width: 260px;
        padding-top: 1rem;
        margin: 0 auto;
    }
    .box{
        display: inline-block;
        width: 100px;
        height: 100px;
        background: lightgreen;
    }
</style>
<body>
    <div class="area">
        <div class="container">
            <div class="box">1</div>
            <div class="box">2</div>
        </div>
        <div class="container">
            <div class="box">3</div>
            <div class="box">4</div>
        </div>
        <div class="container">
            <div class="box">5</div>
            <div class="box">6</div>
        </div>
    </div>
</body>
</html>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
</head>
<style type="text/css">
    *{
        outline: none;
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    .area{
        width: 100%;
        height: auto;
    }
    .container{
        max-width: 260px;
        padding-top: 1rem;
        margin: 0 auto;
    }
    .box{
        display: inline-block;
        width: 100px;
        height: 100px;
        background: lightgreen;
    }
</style>
<body>
    <div class="area">
        <div class="container">
            <div class="box">1</div>
            <div class="box">2</div>
        </div>
        <div class="container">
            <div class="box">3</div>
            <div class="box">4</div>
        </div>
        <div class="container">
            <div class="box">5</div>
            <div class="box">6</div>
        </div>
    </div>
</body>
</html>

一世旳自豪 2025-01-19 16:38:24

使用 laravel 试试这个

<table class="table" style="width:100%">
        @foreach ($isi as $data)
        @if ($loop->iteration % 2 == 1)
            <tr>
        @endif
            <td align="center">
                 <p align="center">image 1</p>
                </td>
                @if ($loop->iteration % 2 == 0)
            </tr>
                @endif
            @endforeach
      </table>

try this using laravel

<table class="table" style="width:100%">
        @foreach ($isi as $data)
        @if ($loop->iteration % 2 == 1)
            <tr>
        @endif
            <td align="center">
                 <p align="center">image 1</p>
                </td>
                @if ($loop->iteration % 2 == 0)
            </tr>
                @endif
            @endforeach
      </table>

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