html - react 图标组件不在 li 中居中
问题描述
https://i.stack.imgur.com/MOyFn.png 我正在使用 react-icons 创建博客文章,但图标组件不在 li 项中居中。我不知道我在css中犯的错误在哪里。任何建议将不胜感激。
import React from 'react';
import './Blog.css';
import { IoLogoFacebook, IoLogoTwitter, IoLogoInstagram, IoLogoYoutube } from "react-icons/io";
const Blog = () => {
return (
<div className="blog-card">
<div className="meta">
<div className="photo"></div>
<ul className="details">
<li className="author"><a href="#">John Doe</a></li>
<li className="date">
<IoLogoFacebook />
Aug. 24, 2020
</li>
</ul>
</div>
</div>
</div>
)
这是CSS
.blog-card .details,
.blog-card .details ul {
margin: auto;
padding: 0;
list-style: none;
}
.blog-card .details {
position: absolute;
top: 0;
bottom: 0;
left: -100%;
margin: auto;
transition: left 0.2s;
background: rgba(0, 0, 0, 0.6);
color: #fff;
padding: 10px;
width: 100%;
font-size: 0.9rem;
}
.blog-card .details ul li {
display: inline-block;
}
解决方案
推荐阅读
- java - 最佳实践:使用 Java 8 Optional 或抛出异常
- python - Pyside2 QTextBrowser overwriteMode 不替换旧文本
- computer-vision - 将拼字游戏屏幕截图解析为数据结构的最佳方法?
- pdfbox - 如何修复 PDFBox 设置的 PDF/A 元数据(使用 Docx4j 和 XDocReport)
- php - 何时清除 Symfony 2 / 3 / 4 中的缓存
- html - 如何选择从某个数字(XPath)开始的所有 h 标签?
- javascript - 如何使用不同的按钮提交 dropzone.js
- heroku - psql:SSL 错误:证书验证失败
- mysql - 删除触发器mysql后旧语句不起作用
- html - 如何编写相对路径表达式 (XPath) 以从以下屏幕截图中提取电子邮件地址?