You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将文本置于大文本下方?404页面排版调整求助

解决404文本与“Page Unfound”上下堆叠的问题

问题出在你的.shell容器的flex-direction属性上,当前设置的row会让子元素横向排列,只需要将其修改为column,就能实现两个文本上下堆叠的效果:

修改后的完整代码:

<!DOCTYPE html>
<html>

<head>
  <style>
    body {
      margin: 0;
      font-family: Arial, Helvetica, sans-serif;
    }
    
    .shell {
      height: 95vh;
      justify-content: center;
      display: flex;
      flex-direction: column; /* 修改为column实现垂直排列 */
      flex-basis: auto;
      margin: 5px 20px;
      align-items: center;
      flex-wrap: wrap;
      color: #D32F2F;
      text-align: center;
    }
    
    .bigtext {
      font-size: 96px;
    }
    
    .smalltext {
      font-size: 24px;
    }
  </style>
</head>

<body>
  <div class="shell">
    <div class="bigtext">404</div>
    <div class="smalltext">Page Unfound</div>
  </div>
</body>

</html>

额外说明:垂直排列场景下flex-wrap: wrap属性作用不大,若不需要可以直接移除。

内容的提问来源于stack exchange,提问作者user20151407

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 22:10:26