Style results as cards

This commit is contained in:
Claude Paroz 2021-07-03 21:09:00 +02:00
parent d7276ca9f0
commit 0327fdb8d8

View file

@ -6,6 +6,7 @@
{% block extrahead %}
<style>
ul { list-style-type: none; padding: 0; }
a { text-decoration: none; }
input#id_text { padding: 10px 0; }
form#search-form p, form#search-form ul {
display: inline-block;
@ -13,9 +14,20 @@ form#search-form p, form#search-form ul {
vertical-align: top;
}
ul.results li { margin: 0; padding: 2px; }
ul.results li, ul.results li * { vertical-align: middle; }
ul.results li:nth-child(odd) { background-color: #eee; }
ul.results { display: flex; flex-wrap: wrap; }
ul.results li {
width: 15em;
padding: 5px 0;
margin: 1.5em;
text-align: center;
border-radius: 8px;
border: 1px solid #ddd;
font-size: 108%;
font-weight: bold;
font-family: sans-serif;
}
ul.results li:hover { background-color: #ddd; }
ul.results li img { width: 100%; }
</style>
{% endblock %}
@ -33,8 +45,11 @@ ul.results li:nth-child(odd) { background-color: #eee; }
<ul class="results">
{% for recette in recettes %}
<li>
<a href="{{ recette.get_absolute_url }}">{{ recette.nom }}</a>
<img src="{{ recette.photo|thumbnail_url:'thumbnail' }}">
<a href="{{ recette.get_absolute_url }}">
{{ recette.nom }}
<img src="{{ recette.photo|thumbnail_url:'thumbnail' }}">
<img src="{{ recette.photo.url }}">
</a>
</li>
{% endfor %}
</ul>