简体   繁体   中英

ng bootstrap dropdown menu styling using deep links

I want to style the ng bootstrap dropdown menu, basically changing its width to auto. But I am not getting how should I target it using /deep/ links.

I want to target the ngbDropdownMenu.

Here is the HTML for it:

 <div ngbDropdown class="d-inline-block">
      <button class="btn btn-custom" id="columnToggle" ngbDropdownToggle ngbTooltip="Filter">
        <fa-icon [icon]="faColumns" title="Select to Show/Hide Columns"></fa-icon>
      </button>
      <div ngbDropdownMenu aria-labelledby="columnToggle">
        <button class="dropdown-item" *ngFor="let column of columnList">
          <label>
            <input type="checkbox" [checked]="column.selected" (change)="changeSelectedColumns.emit(column)" [disabled]="column.disabled"
            /> {{column.header}}
          </label>
        </button>
      </div>
    </div>

You can add a class to your div nbgDropdownMenu

<div ngbDropdownMenu aria-labelledby="dropdownBasic1" class="custom">
     <button class="dropdown-item">Action - 1</button>
     <button class="dropdown-item">Another Action</button>
     <button class="dropdown-item">Something else is here</button>
</div>

.custom{
    background-color:Red;
    width:auto;
    padding:20px;
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM