Can I hide the element if it doesn't fit the available width using css only?

后端 未结 4 1958
盖世英雄少女心
盖世英雄少女心 2020-12-17 10:14

I have a header and an image that should be horizontally laid out on the absolutely positioned div. I\'m showing the text in the subdiv with the fixed width. I\'m trying to

4条回答
  •  鱼传尺愫
    2020-12-17 10:57

    I've found how this can be done. If I use display:block on the .container and float:left in the inner containers, the image will be wrapped if it doesn't fit the width. And if I use overflow: hidden, the image will be moved under the text and hidden.

    Here is the fiddle that proves this trick works: http://jsfiddle.net/8r72g/8/

提交回复
热议问题