admin管理员组文章数量:1328052
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',
}}
>
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',
}}
>
Share
Improve this question
asked Oct 18, 2017 at 7:01
SeaWarrior404SeaWarrior404
4,16816 gold badges47 silver badges66 bronze badges
2
-
2
Have you tried to set
min-height
on you card/table ? – Krusader Commented Oct 18, 2017 at 7:03 - Yeah this worked. Thanks! – SeaWarrior404 Commented Oct 18, 2017 at 7:07
2 Answers
Reset to default 3just add the following style:
minHeight: '30vw'
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'
本文标签: javascriptHow to set minimum height on material cards in Material UIStack Overflow
版权声明:本文标题:javascript - How to set minimum height on material cards in Material UI? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742239317a2438662.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论