[英](React/Material-ui)center text inside paper component in material-ui
I have been trying to center text inside paper component in material ui and currently nothing works.我一直试图在材料 ui 的纸质组件内居中文本,但目前没有任何效果。 I tried to use display:flex in parent component and align-items:center in child component, and I tried to use padding:5px to get equal padding and it didn't work, and absolutely tried text-align and vertical-align and all didn't work here's what it currently looks like:我尝试在父组件中使用 display:flex 并在子组件中使用 align-items:center ,并且我尝试使用 padding:5px 来获得相等的填充,但它不起作用,并且绝对尝试了 text-align 和 vertical-align 和一切都不起作用这是它目前的样子:
I am trying to center that text in the three bottom boxes(paper components in material-ui)我正在尝试将文本放在三个底部框中(material-ui 中的纸质组件)
https://codesandbox.io/s/lingering-snowflake-grvxg?file=/src/App.js https://codesandbox.io/s/lingering-snowflake-grvxg?file=/src/App.js
Try this for the paper class试试这个纸 class
paper: {
display: "flex",
justifyContent: "center",
alignItems: "center",
textAlign: "center",
verticalAlign: "middle"
boxShadow: "4px 4px 4px rgba(0, 0, 0, 0.25)",
borderRadius: "25px",
},
and wrap your questions like so像这样包装你的问题
<Paper className={classes.paper}>
<Typography
// style={{ width: "70%", margin: "auto" }} I think you should avoid break tags instead do something with the width
variant="body2"
color="textPrimary"
component="span"
>
What are Tabaani experience standards and requirements?
</Typography>
</Paper>
why you should avoid break tags here .为什么你应该避免在这里打断标签。 And this is my working example codesandbox .这是我的工作示例代码框。 Cheers干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.