M
M
MIKHAN_GO2020-08-11 08:21:00
HTML
MIKHAN_GO, 2020-08-11 08:21:00

How to organize cards in bootstrap?

I can’t arrange the cards in bootstrap three in a row, tell me how to do this?
below I will attach the html code and the picture of the location of the bootstrap cards

{% extends 'base.html' %}

{% block title %}
<title>Онлайн магазин</title>
{% endblock %}

{% block body %}
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
    <h1 class="display-4">Товары</h1>
    <p class="lead">Товары нашего сайта, которые вы можете приобрести</p>
  </div>
  
  <div class="container">
    <div class="card-deck mb-3 text-center">
    {% if data|length > 0 %}
    {% for el in data %}
    <div class="card mb-4 shadow-sm">
        <div class="card-header">
          <h4 class="my-0 font-weight-normal">{{el.title}}</h4>
        </div>
        <div class="card-body">
          <h1 class="card-title pricing-card-title">{{el.price}}<small class="text-muted">руб.</small></h1>
          <p>{{el.text}}</p>
          <a class="btn btn-outline-primary" href="#">Купить товар</a>
        </div>
      </div>
    {% endfor %}
    </div>  
    {% else %}
    <h1>У нас ещё нет товаров)</h1>
    {% endif %}
{% endblock %}

5f322a8bba4a2805369377.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sashabeep, 2020-08-11
@sashabeep

card must be nested within a col with a width. Columns must be nested in a row - row
https://getbootstrap.com/docs/4.0/layout/grid/
You can use my CSS helper for identical repeating columns https://github.com/sashabeep/bootstrapblockgrid

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question