Cocktail-DB/cocktail_list/templates/homepage.html

48 lines
1.6 KiB
HTML

{% extends "base.html" %}
{% block content %}
{% for cocktail in lista_cocktail %}
<!-- {{ cocktail.ingredienti.all }}
{{ cocktail.nome_cocktail }} -->
{% block css %}
<style>
.text_on_image{
color:white;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-transform: uppercase;
font-size: 2.5em;
font-family: 'Faster One', cursive;
}
a
{
color: inherit;
text-decoration: none!important;
}
a:hover{
color: inherit;
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Faster+One&display=swap" rel="stylesheet">
{% endblock css %}
{% if forloop.first %} <div class="row"> {% endif %}
<div class="col-lg-4 my-3">
<a href="{{ cocktail.get_absolute_url }}">
<div class="card h-100 my-1 border border-info">
<div class="card-img-top"><img src="{{ cocktail.immagine_cocktail.url }}" class="img-fluid" alt="{{ cocktail.nome_cocktail }}"></div>
<div class="text_on_image">{{ cocktail.nome_cocktail }}</div>
<div class="card-body py-0">
<p class="mt-2 mb-0 py-3 text-center">{{ cocktail.ingredienti.all|join:"," }}</p>
</div>
</div>
</a>
</div>
{% if forloop.counter|divisibleby:"3" or forloop.last %}
</div>
{% endif %}
{% if forloop.counter|divisibleby:"3" and not forloop.last %}
<div class="row">
{% endif %}
{% endfor %}
{% endblock content %}