CSS 字体对齐

text-align:justify; 两边对齐
text-align:left; 左对齐
text-align:right; 右对齐
text-align:center; 中间对齐

<html>

<head>
    <title>CSS 对齐</title>
</head>

<body>
    <div style="width: 300px;float:left;margin:20px;">
        <h3 style="text-align:justify;">text-align:justify 两边对齐 </h3>
        <p style="text-align:justify;">
            Melbourne, Australia (CNN)Stefanos Tsitsipas confirmed his status as one of the brightest hopes in tennis
            two days ago,
            upsetting Roger Federer, before becoming the youngest man to reach the Australian Open semifinals in 16
            years with a
            bruising, three-hour quarterfinal win Tuesday.

            He is not a bad salesman, either.
            After defeating a brave Roberto Bautista Agut 7-5 4-6 6-4 7-6 (7-2) in a battle of maiden grand slam
            quarterfinalists,
            the Greek phenom urged a captive Rod Laver Arena to give his YouTube channel some love.
            "If you haven't subscribed, please subscribe," Tsitsipas, who chronicles his travels around the world on
            the channel,
            told spectators Tuesday.
            READ: Tsitsipas ousts Federer
            They will probably do anything he wants, such is the charisma of the 6-foot-4 Greek and their affection in
            turn for the
            fast-rising 20-year-old, currently ranked No. 15 in the world.
        </p>
        <p style="text-align:justify;width:300px;">
            英国还在为脱离欧盟纠结不已,法国和德国又高调地重温半个多世纪前的睦邻友好、同仇敌忾的誓言,签署了《亚琛条约》,宣告法德友好合作的决心和行动目标。

            时间、地点、事件,无不晕染厚重的历史色彩。

            法国总统马克龙和德国总理默克尔1月22日在德国西部边境城市亚琛签署两国友好合作条约,与1963年1月22日他们各自的前辈在巴黎签署的《爱丽舍宫条约》遥相呼应。

            当年的条约和签约这件事本身,被视为变仇敌为睦邻、化干戈为玉帛、世代友好的历史宣言和象征。

            今天的新版友谊宣言,被观察人士解读为意在重振法德轴心在欧盟内的地位。

            地点选在亚琛, 更加重了历史和象征色彩。历史上亚琛曾被归入法国版图,阿尔萨斯-洛林地区说法语还是德语曾经是爱不爱国的选择,地区的归属在历史课本上占据了相当篇幅。

        </p>
    </div>

    <div style="width: 300px;float:left;margin:20px;">
        <h3 style="text-align:left;">text-align:left 左对齐 </h3>
        <p style="text-align:left;">
            Melbourne, Australia (CNN)Stefanos Tsitsipas confirmed his status as one of the brightest hopes in tennis
            two days ago,
            upsetting Roger Federer, before becoming the youngest man to reach the Australian Open semifinals in 16
            years with a
            bruising, three-hour quarterfinal win Tuesday.

            He is not a bad salesman, either.
            After defeating a brave Roberto Bautista Agut 7-5 4-6 6-4 7-6 (7-2) in a battle of maiden grand slam
            quarterfinalists,
            the Greek phenom urged a captive Rod Laver Arena to give his YouTube channel some love.
            "If you haven't subscribed, please subscribe," Tsitsipas, who chronicles his travels around the world on
            the channel,
            told spectators Tuesday.
            READ: Tsitsipas ousts Federer
            They will probably do anything he wants, such is the charisma of the 6-foot-4 Greek and their affection in
            turn for the
            fast-rising 20-year-old, currently ranked No. 15 in the world.
        </p>
        <p style="text-align:left;width:300px;">
            英国还在为脱离欧盟纠结不已,法国和德国又高调地重温半个多世纪前的睦邻友好、同仇敌忾的誓言,签署了《亚琛条约》,宣告法德友好合作的决心和行动目标。

            时间、地点、事件,无不晕染厚重的历史色彩。

            法国总统马克龙和德国总理默克尔1月22日在德国西部边境城市亚琛签署两国友好合作条约,与1963年1月22日他们各自的前辈在巴黎签署的《爱丽舍宫条约》遥相呼应。

            当年的条约和签约这件事本身,被视为变仇敌为睦邻、化干戈为玉帛、世代友好的历史宣言和象征。

            今天的新版友谊宣言,被观察人士解读为意在重振法德轴心在欧盟内的地位。

            地点选在亚琛, 更加重了历史和象征色彩。历史上亚琛曾被归入法国版图,阿尔萨斯-洛林地区说法语还是德语曾经是爱不爱国的选择,地区的归属在历史课本上占据了相当篇幅。

        </p>
    </div>

    <div style="width: 300px;float:left;margin:20px;">
        <h3 style="text-align:right;">text-align:right 右对齐 </h3>
        <p style="text-align:right;">
            Melbourne, Australia (CNN)Stefanos Tsitsipas confirmed his status as one of the brightest hopes in tennis
            two days ago,
            upsetting Roger Federer, before becoming the youngest man to reach the Australian Open semifinals in 16
            years with a
            bruising, three-hour quarterfinal win Tuesday.
    
            He is not a bad salesman, either.
            After defeating a brave Roberto Bautista Agut 7-5 4-6 6-4 7-6 (7-2) in a battle of maiden grand slam
            quarterfinalists,
            the Greek phenom urged a captive Rod Laver Arena to give his YouTube channel some love.
            "If you haven't subscribed, please subscribe," Tsitsipas, who chronicles his travels around the world on
            the channel,
            told spectators Tuesday.
            READ: Tsitsipas ousts Federer
            They will probably do anything he wants, such is the charisma of the 6-foot-4 Greek and their affection in
            turn for the
            fast-rising 20-year-old, currently ranked No. 15 in the world.
        </p>
        <p style="text-align:right;width:300px;">
            英国还在为脱离欧盟纠结不已,法国和德国又高调地重温半个多世纪前的睦邻友好、同仇敌忾的誓言,签署了《亚琛条约》,宣告法德友好合作的决心和行动目标。
    
            时间、地点、事件,无不晕染厚重的历史色彩。
    
            法国总统马克龙和德国总理默克尔1月22日在德国西部边境城市亚琛签署两国友好合作条约,与1963年1月22日他们各自的前辈在巴黎签署的《爱丽舍宫条约》遥相呼应。
    
            当年的条约和签约这件事本身,被视为变仇敌为睦邻、化干戈为玉帛、世代友好的历史宣言和象征。
    
            今天的新版友谊宣言,被观察人士解读为意在重振法德轴心在欧盟内的地位。
    
            地点选在亚琛, 更加重了历史和象征色彩。历史上亚琛曾被归入法国版图,阿尔萨斯-洛林地区说法语还是德语曾经是爱不爱国的选择,地区的归属在历史课本上占据了相当篇幅。
    
        </p>
    </div>

    <div style="width: 300px;float:left;margin:20px;">
        <h3  style="text-align:center;">text-align:center 中间对齐 </h3>
        <p style="text-align:center;">
            Melbourne, Australia (CNN)Stefanos Tsitsipas confirmed his status as one of the brightest hopes in tennis
            two days ago,
            upsetting Roger Federer, before becoming the youngest man to reach the Australian Open semifinals in 16
            years with a
            bruising, three-hour quarterfinal win Tuesday.
    
            He is not a bad salesman, either.
            After defeating a brave Roberto Bautista Agut 7-5 4-6 6-4 7-6 (7-2) in a battle of maiden grand slam
            quarterfinalists,
            the Greek phenom urged a captive Rod Laver Arena to give his YouTube channel some love.
            "If you haven't subscribed, please subscribe," Tsitsipas, who chronicles his travels around the world on
            the channel,
            told spectators Tuesday.
            READ: Tsitsipas ousts Federer
            They will probably do anything he wants, such is the charisma of the 6-foot-4 Greek and their affection in
            turn for the
            fast-rising 20-year-old, currently ranked No. 15 in the world.
        </p>
        <p style="text-align:center;width:300px;">
            英国还在为脱离欧盟纠结不已,法国和德国又高调地重温半个多世纪前的睦邻友好、同仇敌忾的誓言,签署了《亚琛条约》,宣告法德友好合作的决心和行动目标。
    
            时间、地点、事件,无不晕染厚重的历史色彩。
    
            法国总统马克龙和德国总理默克尔1月22日在德国西部边境城市亚琛签署两国友好合作条约,与1963年1月22日他们各自的前辈在巴黎签署的《爱丽舍宫条约》遥相呼应。
    
            当年的条约和签约这件事本身,被视为变仇敌为睦邻、化干戈为玉帛、世代友好的历史宣言和象征。
    
            今天的新版友谊宣言,被观察人士解读为意在重振法德轴心在欧盟内的地位。
    
            地点选在亚琛, 更加重了历史和象征色彩。历史上亚琛曾被归入法国版图,阿尔萨斯-洛林地区说法语还是德语曾经是爱不爱国的选择,地区的归属在历史课本上占据了相当篇幅。
    
        </p>
    </div>
</body>

</html>

MDN:
https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • # Awesome Python [![Awesome](https://cdn.rawgit.com/sindr...
    emily_007阅读 2,253评论 0 3
  • # Python 资源大全中文版 我想很多程序员应该记得 GitHub 上有一个 Awesome - XXX 系列...
    小迈克阅读 3,070评论 1 3
  • meta基础知识 H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 忽略将页面中的数字识别为电话号码 忽略And...
    Mycro阅读 602评论 0 2
  • 一 前两日的夜里,当独自久久静立于寒风瑟瑟的马路边,忽而又回到那个灰色的时节。人们都是灰色的,红绿灯是灰色的,树木...
    路篱_阅读 726评论 1 2
  • 录音实现之AudioRecord类手机录音与播放 【Android】【录音】Android录音--AudioRec...
    ncd阅读 204评论 0 1