如何将MDBootstrap卡排成一排?

我在React项目中使用了MDBootstrap卡,发现在一行中对齐困难。可以对齐3张卡,但是卡仅卡在垂直位置。请参阅下面的代码以供参考。

<MDBContainer>
      <MDBRow >      
      <MDBCol >
      <MDBCard style={{ width: "18rem",borderRadius:'10px'}} >
      { 
        data.map((data,index) => {
          return <div key={index}>
          <MDBCardImage classname="img-fluid" src={data.img}
          waves style={{borderRadius:'10px'}} 
          style={{height:'350px',width:'310px'}} />
          <MDBCardBody>
            <MDBCardTitle style={{color:'black'}}>{data.title}</MDBCardTitle>
            <hr/>
            <MDBCardText>
            {data.content}
            </MDBCardText>
            <MDBBtn href="#">Github</MDBBtn>
            <MDBBtn href="#">Live Demo</MDBBtn>
          </MDBCardBody>
          <br/>
          </div> 
        })
      }  
      </MDBCard>
    </MDBCol>
  </MDBRow>
</MDBContainer>

下面是图像。这就是我得到的最终结果。有解决办法吗?

如何将MDBootstrap卡排成一排?

panlixin 回答:如何将MDBootstrap卡排成一排?

行内仅包含1列,而列内仅具有迭代数据,这导致单列堆叠格式。您的迭代应返回单独的列,例如:

function changeLookup(Lookup) {
    Lookup.focus();
    keyUpEventSim.keyup(Lookup,39,false,true,false);
}
本文链接:https://www.f2er.com/2916072.html

大家都在问