【问题标题】:how to position my BS-CS and stars to the bottom如何将我的 BS-CS 和星星放在底部
【发布时间】:2023-03-23 18:20:01
【问题描述】:

我想修复 BS-CS 和星星部分粘在我的容器底部但我不能这样做我现在应该做什么 这是我的引导代码。

<div className="item1 col-12 col-md-6 col-lg-4 col-xl-4 my-4"> {/* col-12 -> to display only 1 card in mobile of all col // col-md-6 -> display 2 cards in medium devices // col-lg-6 -> also display 2 cards in large devices // col-xl-4 -> display 3 cards in extra large devices */}
                <div className="row teacher_card">
                    {/* for teacher images */}
                    <div className="col-12 col-md-12 col-lg-4 teacher_img">
                        <img src={props.teacher_img} className="img-fluid img_size" alt="Teacher pic" />
                    </div>
                    {/* Teacher Discription infprmation */}
                    <div className="col-12 col-md-12 col-lg-8 teacher_info">
                        <div className="teacher_name"> {/* pt-4 -> padding top 4px // pb-3 -> padding top 3px */}
                            <h1> {props.teacher_name} </h1>
                            <p> {props.teacher_info} </p>
                        </div>
                        <div className="teacher_edu_city ">
                            <div className="teacher_edu_city-in d-flex justify-content-between">
                                <h5> {props.teacher_edu} </h5>
                                <h5> {props.teacher_city} </h5>
                            </div>
                            <p> ???????????????????? </p>
                        </div>
                    </div>
                </div>
            </div>

【问题讨论】:

    标签: javascript html css reactjs bootstrap-4


    【解决方案1】:

    如果您想将星星放在内容的底部,可以使用位置。

    给明星上课

    比在css中:

    .teacher_info {       
        position: relative;        
    }
    
    .stars {   
      position: absolute;  
      left: 0;  
      bottom: 0; 
    }
    

    【讨论】:

      【解决方案2】:

      首先,如果您使用的是 bootstrap 4+,请提供 div.item1 元素 d-flex flex-column 类,或者只需将此样式添加到

      display: flex;
      flex-direction: column;
      

      其次,你可以在div.teacher_edu_city中添加mt-auto,或者使用这种样式

      margin-top: auto;
      

      就是这样。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-01-13
        • 2015-06-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-08-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多