Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

html - Bootstrap doesn't act in as 3 grid layout

Bootstrap’s grid system uses a series of containers, rows, and columns to layout and align content. It’s built with flexbox and is fully responsive.

I am trying to create a 3 grid layout using bootstrap. So far here's my code:

.box-logo-padding a {
  display: inline-block;
  margin: 0px auto;
}
      
@media only screen and (min-width: 360px) and (max-width: 1199px) {
  .box-logo-padding a {
    display: flex;
    margin: 0px !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    text-align: left !important;
  }
}
<div class="experience-section section-padding bg-gray" id="experience">
  <div class="container container-wide">
    <div class="row">
      <div class="col-lg-5 col-sm-12" data-aos="fade-right">
          <div class="sidebar">
              <div class="section-title-one sidebar__inner">
                  <div class="section-title-one-inner">
                    <p>Lorem ipsum </p>

                    <div class="row align-items-center text-center mt-20">
                        <div class="col-lg-4 col-sm-12 box-logo-padding">
                            <a href="#" target="_blank" id="item1"></a>
                        </div>

                        <div class="col-lg-4 col-sm-12 box-logo-padding">
                            <a href="#" target="_blank" id="item2"></a>
                        </div>

                        <div class="col-lg-4 col-sm-12 box-logo-padding">
                             <a href="#" target="_blank" id="item3"></a>
                        </div>

                        <div class="col-lg-4 col-sm-12 box-logo-padding">
                             <a href="#" target="_blank" id="item4"></a>
                        </div>
                        <div class="col-lg-4 col-sm-12 box-logo-padding">
                             <a href="#" target="_blank" id="item5"></a>
                        </div>

                        <div class="col-lg-4 col-sm-12 box-logo-padding">
                              <a href="#" target="_blank" id="item6"></a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
  </div>
</div>




    
      
question from:https://stackoverflow.com/questions/65877909/bootstrap-doesnt-act-in-as-3-grid-layout

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Yes,Bootstrap is build on flexbox but, it follows mobile-first approach. While using Bootstrap-4 and above versions, we have to keep the mobile design in mind. And start from small screens and change our classes as per the larger screen sizes.

Here are the changes that you need to do.

CODEPEN LINK: https://codepen.io/emmeiWhite/pen/xxEogNj

Full Working Code:

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">

<div class="experience-section section-padding bg-gray" id="experience">
  <div class="container container-wide">
    <div class="row">
      <div class="col-lg-5 col-sm-12" data-aos="fade-right">
          <div class="sidebar">
              <div class="section-title-one sidebar__inner">
                  <div class="section-title-one-inner">
                    <p>Lorem ipsum </p>

                    <div class="row align-items-center text-center mt-20">
                        <div class="col-12 col-lg-4 col-md-6 box-logo-padding">
                            <a href="#" target="_blank" id="item1">Item 1</a>
                        </div>

                        <div class="col-12 col-lg-4 col-md-6 box-logo-padding">
                            <a href="#" target="_blank" id="item2">Item 2</a>
                        </div>

                        <div class="col-12 col-lg-4 col-md-6 box-logo-padding">
                             <a href="#" target="_blank" id="item3">Item 3</a>
                        </div>

                        <div class="col-12 col-lg-4 col-md-6 box-logo-padding">
                             <a href="#" target="_blank" id="item4">Item 4</a>
                        </div>
                        <div class="col-12 col-lg-4 col-md-6 box-logo-padding">
                             <a href="#" target="_blank" id="item5">Item 5</a>
                        </div>

                        <div class="col-12 col-lg-4 col-md-6 box-logo-padding">
                              <a href="#" target="_blank" id="item6"> Item 6</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
  </div>
</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...