简体   繁体   中英

How to set minimum height on material cards in Material UI?

I have a card which has a table nested inside it. The card expands as the table expands. However when the table has no data or a single entry, the card also shrinks. I want to set a minimum height to the card so that even if my table inside has just one entry or no entries , the card does not shrink. However it should expand when the table gets populated by more rows.

My code is as follows:

    const BaseCard = () =>
       <div id="card-containerBase">
       <Card
          style={{
          width: '100%',
          margin: 'auto',
          padding: '10px',
          backgroundColor: '#ECEFF1',
    }}
   >

As @Krusader points out, the minimum height can be set using min-height. However inside material UI Card styling the property should be set as minHeight. I set the parameter as:

    minheight: '30vw'

只需添加以下样式:

minHeight: '30vw'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM