首页 > 解决方案 > 为什么我的打字组件没有垂直对齐?

问题描述

我正在制作一个网站投资组合,我一直在使用这个代码片段来输入:

const TypingParagraph = styled.span`
  font-family: "Times New Roman";
  margin-left: 6rem;
  color: white
  &::before {
    content: '_';
    color: transparent
  }
  &::after {
    content: '_';
    display: inline_flex;
    animation: ${rotate} 0.7s linear infinite;
  }
`;

但由于某种原因,它并没有与其父组件垂直对齐。它看起来像 这样

此外,改变字体大小也会改变边距也很奇怪。

对此的任何帮助将不胜感激,谢谢!

标签: javascripthtmlcssreactjsstyled-components

解决方案


推荐阅读