css - React js语义菜单项在中心
问题描述
您好,我无法将我的内容放在此 div 的中心
代码: https ://codesandbox.io/s/hungry-https-c5432
我试图将内联显示放在 h5 上,但它仍然无法正常工作
<div className="App">
<Menu
className="borderless"
style={{ width: "240px", height: "100vh" }}
vertical
>
<Menu.Item className="logo">
<Image src={logo} style={{ width: "50px", height: "50px" }} />
<h5>E M A S A</h5>
<Divider style={{ color: "#000 !important" }} />
</Menu.Item>
</Menu>
</div>
CSS:
.ui.menu {
border-radius: 0px !important;
border: 0px !important;
box-shadow: none !important;
background-color: #252631 !important;
}
.ui.menu .item {
padding: 8px !important;
}
r {
margin-bottom: 0 !important;
}r {
margin-bottom: 0 !important;
}
解决方案
为了使img居中对齐,您可以添加
margin: 0 auto;
display: block;
并为对齐文本h5您可以添加
text-align: center;
检查此链接:https ://codesandbox.io/embed/sweet-glitter-9toif?fontsize=14&hidenavigation=1&theme=dark
推荐阅读
- php - 无法使用 php 插入 MySQL 数据库
- angular - 如何更改角垫扩展面板方向
- electron - 如何检查电子中是否按下了某个键?
- reactjs - 无法使用 Formik 在 FieldArray 中设置FieldValue
- reactjs - 在 react-bootstrap 中验证 select 类型的输入
- javascript - 多个具有相同名称的命名捕获组
- dependency-injection - 使用 autofac 解决在不同项目中注册的组件的依赖关系
- oauth - In OAuth2, is the /introspect endpoint meant for the OAuth Client to call, or the OAuth Resource Server to call?
- python - 在生产环境中运行两个烧瓶 API 的 Python 应用程序
- c# - 使c#线程中的代码段不可中断