且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当大于页面宽度时,将父div扩展为子大小

更新时间:2023-11-30 19:56:58

您想要的内容类似于收缩包装. http://jsfiddle.net/e5Lkq/2/

What you want is similar to a shrink-wrap. http://jsfiddle.net/e5Lkq/2/

.outer { display: table }

要获得旧版IE支持,可以在 block 容器内使用 inline-block (在默认的内联元素上).参见

To get old IE support, you can use inline-block (on a by-default inline element) inside a block container. See this and this (if you're really concerned about support). But I strongly encourage you to drop support (if you can). Is the extra 8% worth the effort? Also note that the percentages are different depending on the site.