css - 无法从 material-ui TabPane 中删除填充
问题描述
我一直在尝试删除填充。根据SO的一些答案,这就是我需要做的:
<TabPanel
value={value}
index={i}
classes={{
"& .MuiBox-root": {
padding: "0px",
},
}}
>
但是,这没有任何效果。
当我检查页面时,我发现我必须删除MuiBox-root-9
才能删除填充。删除MuiBox-root
没有效果:
<div class="MuiBox-root MuiBox-root-9">
而且我不知道如何定位那个类MuiBox-root-9
。
解决方案
如果我没记错的话,那TabPanel
是您创建的组件,而不是来自材料的组件,所以如果您按照此示例进行操作。
function TabPanel(props) {
const { children, value, index, ...other } = props;
return (
<div
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
{...other}
>
{value === index && (
<Box sx={{ p: 3 }}>
<Typography>{children}</Typography>
</Box>
)}
</div>
);
}
您可以删除sx={{ p: 3 }}
以使您的面板没有padding
.
推荐阅读
- java - 我该如何解决其中的重复代码?
- c# - 如何使用 Linq 将一个列表投影到另一个列表?
- azure - 使用 ARM 模板部署 AKS 群集偶尔会失败并出现 PutNetworkSecurityGroupOperation 错误
- arrays - MS SQL Server、数组、循环和将合格数据插入表中
- python - 在 openpyxl 中使用 Translator 复制公式
- struct - 实现特征而不重复结构上已经定义的方法
- html - 根据窗口大小绘制游戏板/桌子大小
- augmented-reality - AR.js 自定义标记
- gcc - 将 VS 内联汇编器翻译成 GCC 内联汇编器
- xamarin.forms - 如何让应用程序窗口默认最大化