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

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

使用material-ui覆蓋子類屬性

使用material-ui覆蓋子類屬性

慕森卡 2023-08-18 17:24:04
這是我的第一個問題,所以我希望能夠正確解釋。我已經導入了一個 datepicker 元素,并且嘗試通過執行以下操作來覆蓋類屬性:const useStyles = makeStyles({    testingWidthLimit: {      width: '180px !important',      minWidth: '180px !important',      maxWidth: '180px !important',    },};const { testingWidthLimit } = useStyles();<InputDate  className={testingWidthLimit}  {other properties here}/>由于我的初學者聲譽,我無法發布圖片,但這就是屏幕上呈現的內容:<div class="sc-gXZlrW ikzFYF makeStyles-testingWidthLimit-3">  <div class="react-date-picker react-date-picker--closed react-date-picker--enabled">    <div class="react-date-picker__wrapper">      (the rest goes here but that is not important)    </div>  </div></div>哦,班級"react-date-picker__wrapper"財產"min-width: 264px"仍然存在正如您所看到的,我已經嘗試了我所知道的所有屬性,但仍然不會覆蓋子屬性。我無權訪問 InputDate 代碼,但我必須使用它。我嘗試使用 !important (有或沒有空格,就像我在其他問題上看到的那樣)和一次一個屬性,但仍然不起作用,有人能告訴我我錯過了什么嗎?Edit1:在第一個 div 上,我的類正在被應用,所有屬性都帶有 !important 標簽。
查看完整描述

1 回答

?
森林海

TA貢獻2011條經驗 獲得超2個贊

以下是使用 CSS 類覆蓋元素后代min-width所需的語法:react-date-picker__wrappertestingWidthLimit


const useStyles = makeStyles({

? ? testingWidthLimit: {

? ? ? "& .react-date-picker__wrapper": {

? ? ? ? minWidth: 180,

? ? ? }

? ? },

};

如果您需要min-width在后代和testingWidthLimit元素本身上進行設置,那么您需要以下內容:


const useStyles = makeStyles({

? ? testingWidthLimit: {

? ? ? minWidth: 180,

? ? ? "& .react-date-picker__wrapper": {

? ? ? ? minWidth: 180,

? ? ? }

? ? },

};

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

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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