简体   繁体   English

在列弯曲方向内使用行弯曲方向

[英]use row flex direction within column flex direction

In this component, I have an image at the top and then other components at the bottom that appear as different rows.在这个组件中,我在顶部有一个图像,然后在底部有其他组件,它们显示为不同的行。

    <main className='content'>
    <img src={poly} alt="charts" className="charts" />
    <div className="heading">
    Heading Text
    </div>
    <span> The he text goes here. </span>
      <div className="popup">
  <Popup/> 
  </div >
  <div className="regressionSetup">
    <ItemsContainer/>
    </div>
      </main>
.content{
    padding-left: 260px;
    padding-top: 100px;
    display: flex;
    flex-direction: column;
    background-color: white;
}

.popup{
    padding-bottom: 20px;
}

.charts{
    align-self: center;
    height: 350px;
    width: 800px;
}

.heading{
    font-size: 25px;

}

.regressionSetup{
    flex-direction: row;
}

The component further has two components: a grid and a chart that appears below the grid.该组件还具有两个组件:网格和出现在网格下方的图表。 I want the grid and chart to appear in the same line.我希望网格和图表出现在同一行。 I tried adding flex-direction: row to className="regressionSetup" but it did not work.我尝试将flex-direction: row添加到className="regressionSetup"但它不起作用。

在此处输入图像描述

ItemsContainer:物品容器:

        return(
            <div className="container-fluid pt-4">
                <div className="row justify-content-center">
                    <div className="col-12 col-sm-12 col-md-12 col-lg-4 ">
                        <PointDrawer addCoord={this.addCoord.bind(this)} resetCoords={this.resetCoords.bind(this)}/>
                        <RegressionSetup
  order_graph_1={this.state.order_graph_1}
  order_graph_2={this.state.order_graph_2}
  setOrders={(orders: any) => this.setState(orders)}
/>
                    </div>
                    <div className="col-12 col-sm-12 col-md-12 col-lg-8">
                        <Graph x={this.state.x_array} y={this.state.y_array} deg={this.state.order_graph_1} width={800} color={this.color_graph_1} />
                    </div>
                </div>
            </div>
            
        );

How can I change this such that the grid appears on the left and the chart appears on the right but in the same line?如何更改此设置,使网格出现在左侧,图表出现在右侧但在同一行?

I think you forgot to add display: flex before adding flex-direction without it flex-direction will not work我认为您忘记添加display: flex在添加flex-direction之前没有它flex-direction将不起作用

It's not .regressionSetup that is going to make the items appear on the same row so there is no need to have flex-direction on this class.不是.regressionSetup会使项目出现在同一行,因此不需要在此 class 上设置flex-direction It is <div className="row justify-content-center"> in your ItemsContainer that will because that is where the row is.它是ItemsContainer中的<div className="row justify-content-center"> ,因为那是行所在的位置。

I could only suggest that your screen is at a breakpoint that has the columns at full width instead of 1/3 and 2/3 which occurs are large screen size as defined in your bootstrap classes.我只能建议您的屏幕处于一个断点处,该断点的列是全宽,而不是 1/3 和 2/3,这是您的引导类中定义的大屏幕尺寸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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