亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

減少 Angular Material 標簽標簽寬度的正確方法?

減少 Angular Material 標簽標簽寬度的正確方法?

BIG陽 2023-02-24 15:28:09
問題由于/deep/、>>>和已被棄用,在桌面上減少最小寬度為160px::ng-deep的寬度的正確方法是什么?mat-tab-label沒有在主要覆蓋它styles.css我仍然希望將 Material Tabs 的這種自定義樣式限定在父組件范圍內。材料規格聲明Fixed tabs display all tabs on one screen, with each tab at a fixed width. The width of each tab is determined by dividing the number of tabs by the screen width. They don’t scroll to reveal more tabs; the visible tab set represents the only tabs available.然而,這并不完全正確,在我的例子中,max-width我的父組件設置為320px,這大致允許每個106pxmat-tab-label。編輯 1由于關注點分離, Angular Material 文檔提倡的Add the overriding style to your global stylesheet. Scope the selectors so that it only affects the specific elements you need it to.正是我想要避免的
查看完整描述

1 回答

?
交互式愛情

TA貢獻1712條經驗 獲得超3個贊

我最終MatTab在全局中定義了一個自定義樣式styles.css:


your-component-selector {

  .mat-tab-label {

    min-width: 25px !important; // In addition to mat-strech-tabs allowing tabs to fill remaining space in parent container

    padding: 5px;

  }

}

your-component-selector將進行范圍界定,自定義樣式不會在其他組件MatTab實例中流血。

不要忘記使用mat-stretch-tabson<mat-tab-group>來拉伸 Angular Material 選項卡以適應父寬度。


查看完整回答
反對 回復 2023-02-24
  • 1 回答
  • 0 關注
  • 173 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號