2014-12-29 48 views
0

我必须创建一个基于Bootstrap 3框架的响应式网站应用程序。Bootstrap Responsive Images的问题

Bootstrap 3使事物响应的方式是具有12个可缩小的列的网格布局。

据我所知,Bootstrap 3首先为移动设计并且可以扩展(!!)。

问题是无论我如何重新编码12列网格系统的排列,也不管我是否定义了最小宽度,最小高度,最大宽度,最大高度,宽度,高度等要定义固定尺寸的图像,图像要么缩小非常小,要么缩小非常大 - 我的客户不喜欢这样!

下面是我正在处理的代码。首先是HTML代码,然后下面的CSS代码在单独的样式表中(工作正常)。

非常感谢您在解决此问题上的任何帮助。

<!-- BEGIN HEADER --> 
<!-- <header> --> 
    <!-- BEGIN container for HEADER DIV --> 
    <!-- BEGIN DIV for top header DIVs --> 
    <div id="headerdivs" class="pad-section"> 
     <div class="container"> 
     <div class="row-fluid" style="height: 200px;"> 


      <div class="col-xs-4 text-center" style="background: blue;"> 
      <p class="lead"></p> 
      </div>  

      <div class="col-xs-4 text-center" style="background: red;"> 
      <div style="position: relative;"> 
       <span class="logotop"><a href="index.html"><img src="images/logo.png" height="200" width="168" alt="" class="img-responsive" /></a></span> 
      </div> 
      </div> 

      <div class="col-xs-4 text-center" style="background: blue;"> 
      <p class="lead"></p> 
      </div> 


     </div> 
     </div> 
    </div> 
    <!-- END DIV for top header DIVs --> 
    <!-- END container for HEADER DIV --> 
<!-- </header> --> 
<!-- END HEADER --> 

.logotop { 

    position:relative; 
    left: 0px; 
    bottom: 0px; 
    color: white; 
    width: 200px; 
    max-width: 200px; 
    min-width: 200px; 
    height: 168px; 
    max-height: 168px; 
    min-height: 168px; 
    z-index:1001; 
} 
+3

和你能指望什么发生? – DaniP

+0

你的意思是这样的效果:http://www.bootply.com/JKwJuaHDes – Banzay

+0

@Danko,我期望图像只能缩放到较小的尺寸,但在分辨率较大时保持定义的尺寸。 –

回答

0

我要去猜,你包括引导CSS充分和未经编辑的版本 - https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css

,你所遇到的问题是,在CSS中有一个声明确保所有图像都设置为100%,并使用!important覆盖任何其他设置。

img { 
    max-width: 100%!important 
} 

已包含在仅针对.logotop类的CSS,并在CSS特异性引导样式TEH img将胜出的顺序。

包括这个作为你的CSS来代替:

.logotop img { 
    //your styles here 
} 
+0

实际上,我能够通过将此图像放置在顶部标题导航栏中的Bootstrap“navbar-brand”类中,然后查找将此品牌移动到页面中心的代码来解决此问题(这引发了更多问题) ,但这就是开发/编程:解决一个问题引发了更多需要逐步解决的问题。 –

+0

耶,当你能解决你自己的问题时总是很棒。请将您的问题标记为已解决。 – justinavery

+0

如何将其标记为已解决? –