S
S
SHADRIN2020-04-28 09:38:15
HTML
SHADRIN, 2020-04-28 09:38:15

How to display posts horizontally?

Hello, I am writing a site in Python Django, the problem is that I am looping records from the database and they are all displayed as a line. I
used this code element but it does not work
CSS

.contents li{
  display: inline;
}


HTML
<div class="contents"> 
  {% block content %}
  {% endblock %}
</div>


The loop code
{% extends "main/wrapper.html" %}

{% block content %}
  {% for film in posts %}
    <li><a href="/{{film.id}}"><img  src="static\image\moonlight.jpg" width="203" height="291"></a>
    <h3>{{film.title}}</h3></li>
  {% endfor %}

{% endblock %}


The task is that the output would be horizontal, how to implement?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
approximate solution, 2020-04-28
@shadrin_ss

.contents {
  display: flex;
}

and your li lines up horizontally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question