CSS display: table min-height not working

后端 未结 4 1031
别跟我提以往
别跟我提以往 2020-12-02 21:33

Does anyone know I can make min-height work with the latest browsers? I am using CSS tables and it seems to ignore min-height.

相关标签:
4条回答
  • 2020-12-02 22:12

    When using tables, height essentially is min-height, as tables always stretch. Just get rid of the "min-" and it will work as you expect.

    0 讨论(0)
  • 2020-12-02 22:12

    Use height: 1px; on the table or any value. Basically you need to give table some height to make it work with min-height. Having only min-height won't work on tables on firefox.

    0 讨论(0)
  • 2020-12-02 22:21

    Whenever you are using display:table; or any deeper property like display:table-cell; consider using height instead of min-height. As in tables height = min-height considering the auto-span feature in them.

    0 讨论(0)
  • 2020-12-02 22:27

    Solution for Firefox

    Add height to unlock setting the min-height

    div {
        display: table;
        width: 100%;
        height: 0;
        min-height: 100px;
    }
    

    The number in height can be any other real value less or equal to min-height for making it work as expected.

    0 讨论(0)
提交回复
热议问题