css 文字两端对齐

复制代码
<body>
    <div class="box">
        <p>姓名</p>
        <p>性与别</p>
        <p>家庭住址</p>
        <p>how are you</p>
        <p>hello</p>
        <p>1234</p>
        <p>1 2 3 4</p>
    </div>
</body>
  • text-align: justify;

  • text-align-last: justify;

  • 设置 text-align: justify; 伪元素 after或者 before的样式,伪元素中可以添加width:100% 或padding-left:100%

相关推荐
溪语流沙8 小时前
【每天一个CSS | Day19】流光文字与一笔写成的手写签名
前端·javascript·css
一水鉴天18 小时前
统一对象拓扑(UOT)设计全链定稿:从三件事分离到三继承 之1 20261010(豆包“查看聊天内容”继续)
前端·css
song5011 天前
React Native for OpenHarmony 实战:三方库 react-native-css-transformer 的鸿蒙化适配指南
css·人工智能·深度学习·react native·transformer
思码梁田2 天前
CSS transform 转换详解:translate、rotate、scale、skew 与 3D 变换一次讲清
前端·css·transform·skew·scale·translate·rotate
三天不学习3 天前
Tailwind CSS 快速入门(2026 版):从 v4 零配置上手,到「该不该用、怎么用好」的选型实战
前端·css·tailwind
htzyl2063 天前
前端阶梯——第九章、颜色、文本与背景
前端·css
htzyl2063 天前
前端阶梯——第八章、CSS入门与选择器
前端·css
传人4 天前
页面中心圆圈放大效果如何写
前端·css
被摘下的星星4 天前
CSS 基础说明
前端·css
传人once5 天前
网页文字滚动效果如何做
前端·css·html·jquery·html5