簡體   English   中英

如何刪除材料 ui 自動完成文本字段中的邊框

[英]How to remove the border in material ui autocomplete text field

 <Autocomplete
                  style={{ width: "178px" }}
                  options={getCites()}
                  renderInput={(params) => (
                    <TextField
                      color="warning"
                      className={Styles.brandfont}
                      {...params}
                      label=""
                      placeholder="All Emirate"
                      variant="standard"
                      inputProps={{
                        disableUnderline: true,
                        ...params.inputProps,
                        style: { fontSize: "1rem" },
                        underline: {
                          "&&&:before": {
                            borderBottom: "none",
                          },
                          "&&:after": {
                            borderBottom: "none",
                          },
                        },
                      }}
                    />
                  )}
                />

這是我的代碼,我需要刪除文本字段中的底部邊框,我嘗試了很多方法都不起作用。 如果我嘗試安裝 mui make styles 它會顯示一些錯誤。 單獨使用 css 幫助解決這個問題。

在此處輸入圖像描述

Input 具有previousElementSibling ,它在input的父級上設置邊框底部。

它是一個::before偽元素。

你可以使用這個技巧。

.MuiInputBase-root::before {
  border: none;
}


參考

https://developer.mozilla.org/en-US/docs/Web/CSS/::before

https://developer.mozilla.org/zh-CN/docs/Web/API/Element/previousElementSibling

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM