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 :
Section1
Section2
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]: http://i.stack.imgur.com/YEBzA.png [2]: http://i.stack.imgur.com/XZ7uC.png
Why is the width set for these classes? Have you tried max-width?

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

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

评论 抢沙发

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

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

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏