1. 程式人生 > 實用技巧 >css一行文字如何兩端對齊?

css一行文字如何兩端對齊?

專案中領導要求右邊的文字也要對齊;

實現方法

<h3>匯聚優秀遠端人才,賦能企業高速發展</h3>
          <p>
            在這裡,您可以免費招聘,靈活使用優秀遠端人才,全程享受
            <br />專屬客服,實時瀏覽遠端人才線上工作狀態以及進行高效管理
          </p>



h3 {
        font-size: 30px;
        font-weight: normal;
        color: #ffffff;
        text-align: justify;
        line-height: 1;
        margin: 20px 0;
        height: 30px;
        &::after {
          display: inline-block;
          content: "";
          width: 100%;
        }
      }

  h3中一定要新增行高和高度;不然會多出來一行;

參考連結

https://blog.csdn.net/weixin_38629529/article/details/106380242?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.pc_relevant_is_cache&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.pc_relevant_is_cache