【发布时间】:2021-04-04 14:25:38
【问题描述】:
这是在我的基本 html 中。警报会导致我的导航栏上方出现空白。如何让消息只显示 5 秒并自动关闭?
{% if messages %}
{% for message in messages %}
<div class = "alert alert-{{ message.tags }}">
{{ message }}
</div>
{% endfor %}
{% endif %}
【问题讨论】:
-
只能通过 JS 实现定时关闭。但是,您可以使用 html 和 css 添加关闭按钮。这个答案可能会有所帮助:stackoverflow.com/questions/18611195/…
标签: javascript django