我正在使用Bootstrap 3,正如您在代码中看到的,我有两个图像。它们都有“.img-responsive”类,所以我不知道为什么只有第一个调整大小而第二个调整大小相同。
HTML:
<div class="container-fluid">
<img src="img/ea.png" class="img-responsive" id="img-center" width="700" height="229">
</div>
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 frase">
<p>LOREM IPSUM</p>
</div>
</div>
</div>
<div class="container-fluid">
<a href="#">
<img src="img/arrow.PNG" class="img-responsive" style="margin:0 auto;" width="80px" height="65px">
</a>
</div>
如果你想知道,id“img-center”只有“margin:0 auto”和“margin-bottom:45vh;
答案 0 :(得分:2)
将width
和height
属性应用于元素时,它将覆盖width: 100%
.img-responsive
设置。
但是,第一张图像是响应而第二张图像没有响应的原因是,您没有将px
附加到第一张图像的尺寸末尾。浏览器不知道如何解释,因此它将恢复为原始的width: 100%;
设置。
<img ... class="img-responsive" ... width="700" height="229">
<img ... class="img-responsive" ... width="80px" height="65px">
要使两个图像都具有响应性,您必须删除固定的大小调整属性。
<img src="img/ea.png" class="img-responsive" id="img-center">
<img src="img/arrow.PNG" class="img-responsive" style="margin:0 auto;">
答案 1 :(得分:0)
这是因为您在这两者中使用了不同的内联样式IndexView is missing a QuerySet. Define IndexView.model, IndexView.queryset, or
override IndexView.get_queryset().
Request Method: GET
Request URL: http://127.0.0.1:8000/polls/
Django Version: 1.8.3
Exception Type: ImproperlyConfigured
Exception Value:
IndexView is missing a QuerySet. Define IndexView.model, IndexView.queryset, or
override IndexView.get_queryset().
Exception Location: /usr/local/lib/python2.7/dist-packages/
Django-1.8.3-py2.7.egg/django/views/generic/list.py in get_queryset, line 44
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path:
['/home/eddy/Documentos/django/mysite',
'/home/eddy/.local/lib/python2.7/site-packages/setuptools-18.0.1-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/setuptools-18.0.1-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/virtualenv-13.1.0-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/Django-1.8.3-py2.7.egg',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/home/eddy/.local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
和width
,因此请尝试删除内联样式,因为这样会阻止类height
适用。
首先img:
img-responsive
第二次img:
<img src="http://img.freepik.com/free-photo/background-with-white-squares-free-vector_23
-2147501484.jpg?size=338c&ext=jpg" class="img-responsive" id="img-center">
希望这有帮助。看一眼 的 Working Fiddle 强>