开发者

How do I get a div to expand when necessary, like a table does?

When I have a table with a width of 800px and an image within it with a width of 1000px, the table will expand to encompass the image. When I have a div with a width of 800px and the same image within it, the div will remain at 800px and the image will cross over the div's border. How do I get a div to replicate this expand-when-necessary nature o开发者_开发知识库f a table?


Set the width to auto and the min-width to 800px if you don't have to support IE6.

Like this

#mydiv {
    width:auto;
    min-width:800px;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜