material-ui - material-ui: How to top the text in tablecell?
问题描述
I have googled for many hours to find a solution, but it seems to be very difficult to vertically align text within a tablecell. I am confused as to why they make the horizontal alignment easy, while the vertical alignment is that difficult.
<TableCell colSpan={2} align='center' vertical-align='top' >
<Typography variant="h5" gutterBottom >
Task
</Typography>
</TableCell>
解决方案
TableCell
material-ui中的组件不提供这样 vertical-align
的道具,只有align
. 要更改垂直对齐,TableCell
您必须传递一个style
道具(或类名),如下所示:
<TableCell colSpan={2} align="center" style={{ verticalAlign: 'top' }} >
<Typography variant="h5" gutterBottom >
Task
</Typography>
</TableCell>
任何TableCell
不知道的道具都会传递给它的子根(th
在这种情况下为元素),在JSX 中,您可以使用道具和驼峰式对象传递内联样式。style
推荐阅读
- spring - Maven 没有为 spring 框架下载 jar 文件
- java - 阅读 Google Fit 自动生成的活动
- java - 是否可以使用java比较数据库表记录的值?
- elasticsearch - 弹性 - 防止更新文档
- macos - Mac docker start 致命错误:子进程之一失败:com.docker.driver.amd64-linux -addr fd:3 -debug (pid: 1375)
- javascript - 为什么在这种情况下 catch 不返回错误?
- java - 有没有更好(更安全)的方法来获取参数化类型的类?
- python - SQL - 哪个索引将加快 COUNT() 查询
- asp.net-core - 使用 Azure Redis 缓存时如何解决超时等待响应问题?
- html - Rvest html_nodes 无法选择 div.class