Home > Net >  How to achieve Side by side with columns in angular
How to achieve Side by side with columns in angular

Time:12-09

I am new to angular and i am trying to achieve the below data(Array object count is unknown) binding as side by side please give me suggestion source code would be very helpful This is what i want to achieve

CodePudding user response:

Use a grid layout.

.container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 30ch;
}

.item {
  padding: 1rem;
  box-sizing: border-box;
  border: 1px solid black;
}
<div >
  <div >Array item</div>
  <div >Array item</div>
  <div >Array item</div>
  <div >Array item</div>
  <div >Array item</div>
  <div >Array item</div>
  <div >Array item</div>
  <div >Array item</div>
  <div >Array item</div>
  <div >Array item</div>
</div>

CodePudding user response:

You can achieve that in many different ways.

  1. You can just use pure css, and then you can either use grid or flex.
  2. Use lib/module, like basscss or @angular/flex-layout which basically are doing the same and/or more.
  • Related