开发者

How do I get a block to fill the remainder of the horizontal space beside a float without using `overflow: hidden` or margins?

The technique I'm most accustomed to in setting a block beside a float is to set the block to have overflow: hidden; and it expands to fill the "remaining" horizontal space, assuming it itself doesn't have descendant block elements that make it impossible.

Example: http://jsfiddle.net/hPBHM/

I'm al开发者_JAVA技巧so familiar with the use of putting the float's width as the margin of the other block. But this isn't suitable 100% of the time, especially when the float's width is not known.

Is the only remaining option to use table-cell? Are there other possibilities I'm overlooking?


As far as I know, there are not more possible solutions with CSS alone.

There is of course, the JavaScript way, if it's critical and width is not known. But that's not a recommended approach for normal cases.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜