django CSS设计复选框太小 [英] django css design checkbox too small
问题描述
我已经从互联网上下载了一个设计,但是该复选框太小。我没有太多时间,所以有人可以告诉我如何覆盖css文件中的设置。
I have downloaded a design from the internet but the checkbox are too small. I don't have much time so can someone tell me how to overwrite the setting in the css file. Nothing seems to work.
django模板如下:
the django template is as follows:
<form class="site-form" action="{% url 'doc_aide:the_doc_aide' pk=patient.id %}" method="post"
enctype='multipart/form-data'>
{% csrf_token %}
<header class="first major">
<h2 class="icon fa-file-alt">Doctors Notes</h2>
</header>
{{ formset.as_p }}
<input type="submit" class="btn btn-default" value="Write Prescription">
</form>
css文件是我无法添加的,但是我可以向您保证
the css file is rather I can't add but I can ensure you that
input [type = checkbox]无处可寻,如果我添加一个新设计,它也不会改变任何东西。
input[type=checkbox] is nowhere to be found and if I add a new design it doesn't change anything.
我如何找出特定代码在哪里,所以我可以更改它吗?
How can I find out where that particular code is so I can change it?
推荐答案
该表单已以HTML格式填充到您的模板中。要更改样式,您需要将CSS作为静态文件应用。
The form is populated as HTML into your template. To change the styling you need to apply CSS as static file.
模板
# Include the static file into the template
{% load static %}
<link href="{% static 'css/your_css_file.css' %}" rel="stylesheet" type="text/css">
<form class="site-form" action="{% url 'doc_aide:the_doc_aide' pk=patient.id %}" method="post"
enctype='multipart/form-data'>
{% csrf_token %}
<header class="first major">
<h2 class="icon fa-file-alt">Doctors Notes</h2>
</header>
# Add a container to your form
<div id="form-container">
{{ formset.as_p }}
<input type="submit" class="btn btn-default" value="Write Prescription">
</div>
</form>
将表格包装在div容器中并应用CSS:
Wrap your form in a div-container and apply CSS:
CSS
#form-container input {
height: 5vh;
width: 5vw;
etc.
}
// or without container
.btn {
your styling: here;
}
Settings.py
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
这篇关于django CSS设计复选框太小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!