CSS/Bootstrap Grid Row Alignment

52 Views Asked by At

I can't understand why this nested grid row has the space above it. I want to align it to the center. I'd like to just select and align to center much like Excel.

I have a fluid container with a nested grid row with three columns and another grid row nested in the first column, but its like I've pressed return and there's a space above it.

TIA!

gridrow alignment issues

.row>div:not(.row) {
  background: #ddd;
}

.row .row>div {
  background: pink;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">

<div class="container-fluid">
  <div class="row">
    <div class="col-xl-4">
      <div class="row">
        <div class="col-xl-6">Col content</div>
        <div class="col-xl-6">Col content</div>
      </div>
    </div>
    <div class="col-xl-4">Col content</div>
    <div class="col-xl-4">Col content</div>
  </div>
</div>

1

There are 1 best solutions below

1
Elia d'Albenzio On

Don't use

<div class="container-fluid">

but use this

   <div class="col-12 d-flex justify-content-center">
     //like your code
   </div>

col-12 is only an example, change with the number that you want.