css - 如何使用验证表单按钮自定义具有固定标题标题和固定页脚的表单(html)?
问题描述
我开发了 Django 应用程序,需要为数据输入自定义标准表单,以适应下面附加图像中的结构。
您还可以查看我当前的“完成工作”的代码,但想知道这是否是这样做的好方法,或者是否有更好的做法。
我已经为我的固定标题标题、固定页脚底部和我的 2 个按钮“保存”和“取消”定义了 CSS 类
html
<nav class="navbar navbar-expand-md navbar-dark bg-info fixed-top" style="padding-top: 50px;">...</nav>
<!-- content form for field data entry -->
<div class="box row-full" id="heading-title">
<h3>Nouveau projet</h3>
</div>
<div class='container' style="margin-top:200px;margin-bottom:200px">
<form id="projecteditform" method="POST" class="post-form">
{% csrf_token %}
{{ form|crispy }}
<button id="ajouter_projet" class="btn btn-info .fixed-save" type="submit"
style="width: 100px; z-index:2">Valider</button>
<a data-modal data-target="" class="btn btn-dark .fixed-cancel" href="{% url 'project:index_projet' %}"
style="width: 100px; z-index:2">Annuler</a>
</form>
</div>
<div class="box row-full" id="footer-buttons"></div>
<!-- end content form for field data entry -->
<footer class="page-footer font-small blue fixed-bottom" style="background-color:white; z-index:1">...</footer>
css
.box {
width: 100px;
max-height: 60px;
color: white;
}
#heading-title {
position: fixed;
padding-top: 20px;
top: 100px;
color:black;
background: white;
}
#footer-buttons {
position: fixed;
bottom: 50px;
background: white;
}
.row-full{
width: 100vw;
position: relative;
margin-left: -50vw;
text-align: center;
height: 100px;
left: 50%;
}
.fixed-save{
position: fixed;
bottom: 80px;
}
解决方案
根据我发现django-widget-tweaks是格式化 django 表单的最佳方法之一
推荐阅读
- ios - 在 Objective-C 中的倒数第二个最右边的 UIBarButtonItem 上设置徽章
- video - 如何自动将特定视频剪辑添加到多个剪辑中
- set - 您如何使集合 B 成为 A 的子集
- perl - 使用 Web::Scraper 提取带有数据标记的 HTML 标记
- python - numpy 2d 矩阵乘法
- android - 如何使项目卡在 RecyclerView 的底部
- html - 如何根据内容设置元素的高度
- php - php curl标头不从网站返回?
- gnuplot - gnuplot:用我想要的颜色绘制矩阵
- regex - 如果后跟特定字符串,则打字稿正则表达式会排除整个字符串