我有一个模态,但它没有在较小的屏幕(平板电脑等)上调整大小.有没有办法让它响应?找不到有关bootstrap文档的任何信息.谢谢
我更新了我的html代码:(它在django for循环中)
<div class="modal fade " id="{{ p.id }}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Producto</h4>
</div>
<div class="modal-body">
<h5>Nombre : {{ p.name}}</h5>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我有这个css设置:
.modal-lg {
max-width: 900px;}
@media (min-width: 768px) {
.modal-lg {
width: 100%;
}
}
@media (min-width: 992px) {
.modal-lg {
width: 900px;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在设计我的django应用程序,但我无法设置表单样式.我有一个联系表单,在我的forms.py中,然后我在模板中使用它.
<form class="form-contact" action="" method="POST">
{% csrf_token %}
<input type="text" name="Name" id="id_name" value="{{form.name}}" />
<input type="submit" value="Submit" class="btn btn-primary">
</form>
Run Code Online (Sandbox Code Playgroud)
那不行.我也尝试了这个,但仍然没有运气,它显示样式字段但不检索信息(我在{{form.errors}}下面收到一条消息.
<form class="form-contact" action="" method="POST">
{% csrf_token %}
{% for field in form %}
<fieldset class="form-group">
<label class="control-label" for="id_{{ field.name }}">{{ field.label }}</label>
<div class="form-control">
<input type="text" class="form-control"
name="{{ field.label }}"
id="{{ field.name }}"
value="{{ field.name }}" >
{{ field }}
<p class="help-text">{{ field.help_text }} </p>
</div>
</fieldset>
{% endfor %}
<input type="submit" value="Submit" class="btn btn-primary">
</form>
Run Code Online (Sandbox Code Playgroud)
任何提示都会被贬低.问候.
编辑:第二个代码实际上显示每个表单字段的2个输入字段.如果我填写第二个,表单有效,但是,第二个输入没有样式...
我已经在本地主机中安装了virtualenv,以运行1.8版本的django应用程序,但是在运行时,css和js文件无法加载。
我懂了
Resource interpreted as Stylesheet but transferred with MIME type application/x-css
Run Code Online (Sandbox Code Playgroud)
我尝试了一些选项,但它们也不能解决问题。我在其他PC上运行相同的配置,并且可以正常工作。
我的HTML使用以下命令加载CSS:
<link href="/static/css/bootstrap.css" rel="stylesheet" type="text/css">
Run Code Online (Sandbox Code Playgroud) 我正在使用轮播来展示一些最受好评的产品,轮播可以工作,但我无法正常工作,似乎问题出在“活跃”类别上。每张“幻灯片”显示 4 种产品。
这是我的代码
<div id="carousel-example" class="carousel slide hidden-xs" data-ride="carousel">
<div class="carousel-inner">
{% for p in prod %}
<div class="item {% if forloop.first %} active {% endif %}"> // here is the problem
<div class="row">
<div class="col-sm-3">
<h1>{{p.name}}</h1>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
如果我不使用 forloop.first,则轮播不会滑动。通过这个 forloop.first,每张幻灯片仅显示一个项目,而不是 4 个项目。
检查器中的输出是:
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-sm-3"> // Here I expect 4 columns and I get only 1
</div>
</div>
</div>
<div class="item">
<div class="row">
<div …Run Code Online (Sandbox Code Playgroud)