简体   繁体   中英

How can I make two different components the same height

I have a react card that can render two different things depending on a whether or not a certain prop is active. How can I ensure that the two different things are the same height, as the cards are not the same size when I put them next to each other?

Here is the code:
<div className={cardInfoClasses}> <h3 className={titleClasses}>{this.props.name}</h3> {cardMain} </div>

cardMain can either be:
<div> <Progress productData={productData} className='mobile_hide'/> </div>; or
<CardButton initialData = {this.props.data}/>

You can accomplish that with display flex or table. You give the parent display flex and adjust other properties like justify-elements and width.

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