我正在開發一個django應用程序,這是一個簡單的網站,我可以從我的管理網站(模型)動態地放置許多圖像。我知道如何在一個循環中在我的html模板中顯示這些圖像,但我不知道如何將這些圖像作爲背景或標題顯示在我的html模板中。有沒有人有一個想法如何我的HTML?我有使用CSS來做到這一點嗎?如何顯示動態圖像作爲背景?
的.html
{% for post in posts %}
<div class=item>
<p>{{ post.nome_hotel }}</p>
<p>{{ post.apresentacao_hotel }}</p>
<picture>{% cloudinary post.foto_hotel %}</picture>
</div>
{% endfor %}
所以你想這樣? https://tympanus.net/Tutorials/CSS3FullscreenSlideshow/index2.html – Beomi
是的,但我不知道這些圖像是否與管理網站(模型)動態放置。如果是的話,我想知道我該如何做到這一點。 – victorcd
當然你可以做到這一點:)製作照片模型,並使視圖返回Photo.objects.all()到您的HTML呈現:) – Beomi