Align two divs horizontally side by side center to the page using bootstrap css

前端 未结 9 2304
春和景丽
春和景丽 2020-12-12 16:07

Please refer below code what i tried

First Div
9条回答
  •  独厮守ぢ
    2020-12-12 16:36

    I recommend css grid over bootstrap if what you really want, is to have more structured data, e.g. a side by side table with multiple rows, because you don't have to add class name for every child:

    // css-grid: https://www.w3schools.com/css/tryit.asp?filename=trycss_grid
    // https://css-tricks.com/snippets/css/complete-guide-grid/
    .grid-container {
      display: grid;
      grid-template-columns: auto auto; // 20vw 40vw for me because I have dt and dd
      padding: 10px;
      text-align: left;
      justify-content: center;
      align-items: center;
    }
    
    .grid-container > div {
      padding: 20px;
    }
    
    
    
    1
    2
    3
    4
    5
    6
    7
    8

    css-grid

提交回复
热议问题