Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 使用Bootstrap 4布局表单数据(用于Django模板中的endfor/data)_Css_Django_Forms_Bootstrap 4 - Fatal编程技术网

Css 使用Bootstrap 4布局表单数据(用于Django模板中的endfor/data)

Css 使用Bootstrap 4布局表单数据(用于Django模板中的endfor/data),css,django,forms,bootstrap-4,Css,Django,Forms,Bootstrap 4,我试图使用引导程序将我的formdata(一些文本和图像)部署到屏幕上,使数据块(文本+图像)彼此相邻,而不是彼此下方。我到处玩弄列大小,但我无法让它工作。在大屏幕上,所有容器都放置在彼此下方。在小屏幕上,布局很好,但在大屏幕上,没有任何内容会翻转到其余的列 <div class="container-fluid"> <h1 class="my-4 text-center text-lg-left">Thumbnail Gallery</h1> {

我试图使用引导程序将我的formdata(一些文本和图像)部署到屏幕上,使数据块(文本+图像)彼此相邻,而不是彼此下方。我到处玩弄列大小,但我无法让它工作。在大屏幕上,所有容器都放置在彼此下方。在小屏幕上,布局很好,但在大屏幕上,没有任何内容会翻转到其余的列

<div class="container-fluid">

<h1 class="my-4 text-center text-lg-left">Thumbnail Gallery</h1>

    {% block content %}
    {% for contexts in context %}
    <div class="col-lg-auto col-lg-auto col-6-auto">
    <h2>Title: {{ contexts.title }}</h2>
    <p>Category: {{ contexts.category }}</p></div>
    <p>Description: {{ contexts.description }}</p>
    <p>Price: {{ contexts.price }}</p>
    <p>Created: {{ contexts.created }}</p>
    <img class="img-fluid img-thumbnail" src="{{contexts.document.url}}" width="20%" height="20%"/>
    </div>
    {% endfor %}
</div>

缩略图库
{%block content%}
{上下文%中的上下文为%1}
标题:{{contexts.Title}
类别:{{contexts.Category}

描述:{{contexts.Description}}

价格:{{contexts.Price}}

已创建:{{contexts.Created}

{%endfor%}
引导程序具有出色的网格类。

我不完全确定你在寻找什么样的布局,但也许这会让你找到正确的方向

<div class="row col-6">
    <div class="col-6 left">
        <h2>Title: {{ contexts.title }}</h2>
        <p>Category: {{ contexts.category }}</p></div>
        <p>Description: {{ contexts.description }}</p>
        <p>Price: {{ contexts.price }}</p>
        <p>Created: {{ contexts.created }}</p>
    </div>
    <div class="col-6 right">
        <img class="img-fluid img-thumbnail" src="{{contexts.document.url}}"/>
    </div>
</div>

标题:{{contexts.Title}
类别:{{contexts.Category}

描述:{{contexts.Description}}

价格:{{contexts.Price}}

已创建:{{contexts.Created}


谢谢@chaggy,它看起来已经好多了,但它仍然只是将所有这些块放在彼此下方,这次将图像放在文本的右侧。我要找的是让这个(文本左/图像右)或文本和图像在彼此下面,但也可以作为一对在彼此旁边。例如,文本-图像-新文本-相邻的新图像或文本/图像对-相邻的新文本/图像对。取决于屏幕的大小。小屏幕所有东西都在彼此下方,大屏幕尽可能相邻如果你能链接到你要找的东西的可视示例,也许我可以帮助你这样做->(图片位置(左/上)没那么重要。更像是相邻的文本/图像块(大屏幕/最大列可用)对于该布局,在3个div上使用
col-md-4
类。引导网格基于12,因此大小4是第三个。类的“md”部分是断点大小。我应该在哪里添加3个div?在第二个div中添加col-md-4,但具有相同的行为,即在前4列中彼此放在下面。不使用剩余的9。