How do I specify in HTML or CSS the absolute minimum width of a table cell

前端 未结 7 1851
渐次进展
渐次进展 2020-12-24 10:39

Summary

What\'s the best way to ensure a table cell cannot be less than a certain minimum width.

Example

I want to ensure that all cells in a ta

7条回答
  •  滥情空心
    2020-12-24 11:11

    This is a cross-browser way for setting minimum width and/or mimimum height:

    {
    width (or height): auto !important;
    width (or height): 200px;
    min-width (or min-height): 200px;
    }
    

    IE 6 doesn't understand !important
    IE 6 sees width/height:200px (overwriting auto)

    Other browsers understand the min- and the !important

    I am not 100% familiar with the behaviour of widths in TD elements, but this all works nicely on eg DIV tags

    BTW:

    Based on a combination of Vatos' response and a min-height article here: http://www.dustindiaz.com/min-height-fast-hack/

    This is not working because of the order of the first 2 lines, they need to be in the right order (think about the above) ;)

提交回复
热议问题