0

here is the code:

<div class="row shochatgroup">
  <div  *ngFor="let message of messages" class="col-auto">
    <button *ngIf="message.state.attributes.shochatpaid > 0 && message.state.attributes.shochatpaid < 5" class="paidshowchat1-4 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 4 && message.state.attributes.shochatpaid < 9" class="paidshochat5-9 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 8 && message.state.attributes.shochatpaid < 20"  class="paidshochat10-19 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 19 && message.state.attributes.shochatpaid < 50" class="paidshochat20-49 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 49 && message.state.attributes.shochatpaid < 99"  class="paidshochat50-99 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 99" class="paidshochat100plus btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
  </div>
</div>

and the css:

.shochatgroup{
  overflow-x: auto;
  white-space: nowrap;
}

yet this is what happensenter image description here

I looked at this stackoverflow post and Im not really understanding what they are doing that I am not: Horizontal scrollable div's in a bootstrap row

1 Answers1

1

Your code should run fine as seen below, either your .shochatgroup class must be overwritten by some other css and you are losing white-space: nowrap; somewhere, or the buttons are floated.

.shochatgroup{
  overflow-x: auto;
  white-space: nowrap;
}
<div class="row shochatgroup">
  <div  *ngFor="let message of messages" class="col-auto">
    <button *ngIf="message.state.attributes.shochatpaid > 0 && message.state.attributes.shochatpaid < 5" class="paidshowchat1-4 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 4 && message.state.attributes.shochatpaid < 9" class="paidshochat5-9 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 8 && message.state.attributes.shochatpaid < 20"  class="paidshochat10-19 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 19 && message.state.attributes.shochatpaid < 50" class="paidshochat20-49 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 49 && message.state.attributes.shochatpaid < 99"  class="paidshochat50-99 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 99" class="paidshochat100plus btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
  </div>
</div>
cMarius
  • 1,090
  • 2
  • 11
  • 27