如何在不破坏响应能力的情况下增加利润

时间:2019-05-24 04:10:57

标签: html css django twitter-bootstrap

所以我连续三张卡,但是它们都粘在一起,看上去很难看。我希望每张卡之间都有一定的余量,所以我增加了余量,但是却破坏了引导程序提供的响应能力。因此,我仅添加了填充。任何帮助将不胜感激

<div class="row">
  {% for all_episode in episode %}
    <div class="col-6 col-md-4 card" style="padding:20px">
      <a href="{% url 'episode_detail' slug=all_episode.slug %}">
        <img class="card-img-top" src='{{all_episode.image.url}}'>
      </a>
      <div class="card-body">
        <h5 class="card-title">
          <a href="{% url 'episode_detail' slug=all_episode.slug %}">{{ all_episode.title }}</a>
        </h5>
        <p class="card-text">{{ all_episode.story |slice:":100" }}...</p>
      </div>

      <div class="card-footer">
        <small class="text-muted">
          <span class="h5">
            <a href="{% url 'series_detail' slug=all_episode.series.slug %}">{{ all_episode.series }}</a>
          </span> / 
          <span class="h6">
            <a href="{% url 'season_detail' slug=all_episode.season.slug %}">{{ all_episode.season }}
            </a>
          </span>
        </small>
      </div>
    </div>
  {% endfor %}
</div>

2 个答案:

答案 0 :(得分:0)

您可以调整card

<div class="row">
    {% for all_episode in episode %}
    <div class="col-6 col-md-4">
        <div class="card" style="padding:20px">
            <a href="{% url 'episode_detail' slug=all_episode.slug %}">
                <img class="card-img-top" src='{{all_episode.image.url}}'>
            </a>
            <div class="card-body">
                <h5 class="card-title">
          <a href="{% url 'episode_detail' slug=all_episode.slug %}">{{ all_episode.title }}</a>
        </h5>
                <p class="card-text">{{ all_episode.story |slice:":100" }}...</p>
            </div>

            <div class="card-footer">
                <small class="text-muted">
          <span class="h5">
            <a href="{% url 'series_detail' slug=all_episode.series.slug %}">{{ all_episode.series }}</a>
          </span> / 
          <span class="h6">
            <a href="{% url 'season_detail' slug=all_episode.season.slug %}">{{ all_episode.season }}
            </a>
          </span>
        </small>
            </div>
        </div>
    </div>
    {% endfor %}
</div>

答案 1 :(得分:0)

使用Bootstrap Card Deck,所有卡都将连续显示并响应。

https://getbootstrap.com/docs/4.0/components/card/#card-decks