- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试制作一个使用 Material 指南的深色主题 React 前端。根据dark theme specifications , 表面应该随着每个高程级别而变亮。这似乎不适用于 elevation
material-ui的Paper组件中的属性,好像只加了一个阴影。我想知道这个规范是否已经实现,或者产生这种效果的最佳解决方案是什么。
例子:
<Paper elevation={1}>
<Typography variant="h6">Paper1</Typography>
</Paper>
<Paper elevation={5}>
<Typography variant="h6">Paper2</Typography>
</Paper>
这两张纸有不同的高度,但仍然具有相同的背景颜色。
最佳答案
刚遇到同样的问题。似乎 material-ui 仅通过添加框阴影来实现高程。
我想出了一个快速解决方案( typescript ):
import { lighten, makeStyles, Paper, Theme } from "@material-ui/core";
import React from "react";
const useStyles = makeStyles<Theme, { elevation: number }>((theme) => ({
paper: {
boxShadow: (props) => theme.shadows[props.elevation],
backgroundColor: (props) =>
lighten(theme.palette.background.paper, props.elevation * 0.025),
},
}));
export const CustomPaper: React.FC<{elevation: number}> = ({ children, elevation }) => {
const classes = useStyles({ elevation });
return (
<Paper className={classes.paper}>
{children}
</Paper>
);
};
我发现因子 0.025 产生了不错的外观。然而,我只是通过一些试验和错误想出了它。可能有更复杂的方法。
关于reactjs - 基于海拔的 Material UI 纸背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62529636/
我试图学习python并以此开始,当我尝试运行它时,我一直收到语法错误。光标跳到def start部分的close结束处。我不确定语法错误来自哪里,因为我用语音标记了所有打印件 #! python3
在我的应用程序中,我使用了 polymer 的 paper-dialog 元素。对话框的样式总是将它定位在中心,但我希望它在对话框和窗口右侧之间设置一个最小距离,所以当窗口缩小时,纸质对话框不会靠近右
我需要实现一个石头剪刀布锦标赛模拟器,它将玩完所有回合并返回锦标赛。 这是我的锦标赛数组: tournament = [ [ [ ["Armando",
所以我实际上是用自定义元素包装标准 paper-slider 元素,并希望包含一些样式。以下是我目前拥有的: /* Works */ paper-slider {
对于仅包含图像的 HTML 文档,如何缩放图像以填满整个工作表?我希望图像缩放它的宽度/高度以尽可能大/尽可能小以适合一张纸。 我开始用它来分页 footer {page-break-after:al
我正在尝试扩展 Polymer paper-slider 元素,以便能够获取枚举列表并在 slider 中迭代这些值,而不是仅显示数值。但是我在使样式起作用时遇到了麻烦。如您所见,如果您运行此代码片段
我是 paper.js 的新手。 对于这个项目,我需要一个将在许多情况下使用的形状(具有不同的填充颜色),因此使用符号显然更好(而不是使用 Path.clone() 方法)。但是,一旦我将符号实例化为
我想重新组合我的 PDF 文档以使用我的打印机的 A4 格式在 A5 上打印它们。 我还需要在每个 A5 页面上打印两个站点(幻灯片),当然应该是双面的。因此 A4 页面是横向格式。比我想把它剪在中间
我有两个元素一个在另一个上面,也就是说,一个挡住了另一个。假设 Item2 被 Item1 阻止。现在每当我使用 project.hitTest(Item2); 它工作正常。 但是当我使用鼠标的eve
我有一个网站,它本质上是一个大 Canvas 图像。目前,当 body 被加载时,它开始通过这段代码淡入: 但是我想在我的 paperscript 中调用它,因为有时 body 会在图像从 pape
我是一名优秀的程序员,十分优秀!