0

here is my code image where i am stuck

what i want is button to be display as justify

here is my inspect code from react which is not justifying

I am able to get button as justifying as shown in following image but this is not working in my react code

here is working example which works

my code which is not working as expected

 <div className="hidden-xs buttons col-lg-12 col-md-12">
                    <button>Kartonnen brillen</button>
                    <button>Kartonnen brillen</button>
                    <button>Kartonnen brillen</button>

                    <button>Kartonnen brillen</button>
                    <div className="stretch-spacing-buttons"></div>
                    <button>Kartonnen brillen</button>
                    <button>Kartonnen brillen</button>
                    <button>Kartonnen brillen</button>

                    <button>Kartonnen brillen</button>
                    <button>Kartonnen brillen</button>
                    <div className="stretch-spacing-buttons"></div>

                </div>

css

.buttons {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: justify;
    -ms-text-justify: distribute-all-lines;
    text-justify: distribute-all-lines;
}

.stretch-spacing-buttons {
    width: 100%;
    display: inline-block;
    font-size: 0;
    line-height: 0;
}
Navin Gelot
  • 1,264
  • 3
  • 13
  • 32

1 Answers1

0

Try this: HTML:

<div class="buttons">
  <div class="first-row">
     <button>Kartonnen brillen</button>
     <button>Kartonnen brillen</button>
     <button>Kartonnen brillen</button>
     <button>Kartonnen brillen</button>
  </div>
  <div class="second-row">
     <button>Kartonnen brillen</button>
     <button>Kartonnen brillen</button>
     <button>Kartonnen brillen</button>
     <button>Kartonnen brillen</button>
     <button>Kartonnen brillen</button>
  </div>
 </div>

CSS:

.first-row {
  display:grid;
  grid-template-columns:repeat(4, auto);
  justify-content: space-between;
}
.second-row{
  display:grid;
  grid-template-columns:repeat(5, auto);
  justify-content: space-between;
}

You will find the Codepen here: https://codepen.io/sphr1313/pen/BOpWVg

Sepehr
  • 314
  • 5
  • 21