Resize bootstrap div to fit content

I am using twitter bootstrap to make 2 divs placed side-by-side. Each div has medium and large images inside it, arranged using jquery **isotope**. The problem is that when there are not enough images in a div, the div width remains same and there's a lot of extra space left. Like this : ![enter image description here][1] I want the divs to align centrally and also reduce in width to fit the images inside it. Like this: ![enter image description here][2] My HTML code is this :
My CSS looks like this : #section1 .small{ width:150px; height:200px; overflow:hidden; } #section1 .big{ width:320px; height:420px; overflow:hidden; } #section2 .small{ width:80px; height:100px; overflow:hidden; } #section2 .big{ width:170px; height:220px; overflow:hidden; } Other styles are bootstrap's. [1]: [2]:
Why is the width set for these classes? Have you tried max-width?

以上就是Resize bootstrap div to fit content的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准