javascript - 如何显示不同高度尺寸的图像

标签 javascript html css

我有一行,一行有3篇文章,每篇文章里面有一张照片, 但问题是当我去显示行时出现了一些问题, 问题是照片不能具有相同的高度尺寸,这让我的网站看起来很糟糕。图片链接------ /image/N5EVB.png

注意每张照片的高度都不同

使用 Bootstrap

我的代码

'<div class='row'>
         // product 1
  <div class="col-sm-4 col-lg-4 col-md-4">
   <div class="thumbnail">
     <img src="/*Path here*/">
     <div class="caption max">
       <h2>/*subject*/</h2>
       <h4>Selling by /*name*/</h2>
       <p>/*main-information*/</p>
     </div>
   </div>
  </div>
          // product 2
  <div class="col-sm-4 col-lg-4 col-md-4">
   <div class="thumbnail">
     <img src="/*Path here*/">
     <div class="caption max">
       <h2>/*subject*/</h2>
       <h4>Selling by /*name*/</h2>
       <p>/*main-information*/</p>
     </div>
   </div>
  </div>
         // Product 3
   <div class="col-sm-4 col-lg-4 col-md-4">
   <div class="thumbnail">
     <img src="/*Path here*/">
     <div class="caption max">
       <h2>/*subject*/</h2>
       <h4>Selling by /*name*/</h2>
       <p>/*main-information*/</p>
     </div>
   </div>
  </div>
</div> // closing row '

谢谢。

最佳答案

<style type="text/css"> 
    /* thubnail div */
    .thumbnail {overflow: hidden; box-sizing: border-box;}
    /* all images in thumbnail div*/
    .thumbnail img{min-width: 200px; min-height: 123px; width: 200px; height: 123px; max-width: 200px; max-height: 123px; } 
</style>

关于javascript - 如何显示不同高度尺寸的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42469422/

相关文章:

javascript - 在 EaselJS 中使用 SpriteStage 会使 Sprite 的 mask 不起作用

html - 如何将 Perl 脚本表单结果显示到同一网页?

html - <pre> 不需要时换行

javascript - 从查询字符串创建 CSS 规则

html - 初学者 html 问题::如何让水平滚动条出现?他们只是不会.. td 标签中的数据正在移动到下一行

javascript - 从段落标记中获取值

java - 使用 javascript 动态添加重复(唯一 ID)表单 Div 元素

javascript - 我无法在两个组件之间传递对象(类组件到功能组件)

javascript - 使用 iframe 阻止按键的默认操作

html - 操作<nav> <ul> </ul> </nav>中的单个<li>元素