How can I scale a div to 100% height and width inside of another element

后端 未结 3 1031
青春惊慌失措
青春惊慌失措 2021-01-06 01:21

How can I scale a div to 100% height and width inside of another element? In my case a sourrounding td. Since I\'m a plugin I can not control the other HTML on the page. Her

3条回答
  •  一生所求
    2021-01-06 01:39

    Using javascript / jquery you can easily get the height of the parent element and resize your div accordingly.

    However, as the div is located in a table cell, the width is not fixed as the cell would expand and contract according to the contents of the other cells in the table. So there really is no correct width, the cell will adapt itself according to the contents of all cells.

    By the way, your height problem would be easily solved setting it to 400px, but I guess the shown table structure is just an example (1 row, 400px height...).

提交回复
热议问题