This question already has answers here:
Flexbox: center horizontally and vertically
                                
                                    (11个答案)
                                
                        
                                在10个月前关闭。
            
                    
段落元素不在另一个段落元素的下一行。



body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: #000;
}

p {
  position: relative;
  font-family: sans-serif;
  text-transform: uppercase;
  font-size: 2em;
  letter-spacing: 4px;
  overflow: hidden;
  background: linear-gradient(90deg, #000, #000fe6, #000);
  background-repeat: no-repeat;
  background-size: 80%;
  animation: animate 3.75s linear infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: rgba(45, 45, 45, .05);
}

@keyframes animate {
  0% {
    background-position: -500%;
  }
  100% {
    background-position: 500%;
  }
}

<body>
  <p>Title</p>
  <p>Tag Line</p>
</body>





在这里,标语线应位于标题下方,但在标题旁边。

段落元素不在另一个段落元素的下一行。

最佳答案

您可以在正文中添加flex-direction:column;

关于html - 段落元素不在其他段落元素的下一行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55392599/

10-10 06:02