css中的文字排版处理 writing-mode ,text-orientation, text-combine-upright, letter-spacing运用

这样的古诗排版,需要了解writing-mode

 writing-mode 属性定义了文本在水平或垂直方向上如何排布。

语法格式如下:

writing-mode: horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr
  • horizontal-tb:水平方向自上而下的书写方式。即 left-right-top-bottom
  • vertical-rl:垂直方向自右而左的书写方式。即 top-bottom-right-left
  • vertical-lr:垂直方向内内容从上到下,水平方向从左到右
  • sideways-rl:内容垂直方向从上到下排列
  • sideways-lr:内容垂直方向从下到上排列

CSS中的text-orientation属性用于设置字符在一行中的方向。

此属性在垂直脚本中很有用,例如创建垂直表标题,定义行名等。

用法: text-orientation:mixed|upright|sideways;

    <div class="poem">
        <h1>望庐山瀑布</h1>
        <div class="year">
            <span class="author">李白</span>
            <span>701</span>
            <span>~</span>
            <span>706</span>
        </div>

        <p>日照香炉生紫烟</p>
        <p>遥看瀑布挂前川</p>
        <p>飞流直下三千尺</p>
        <p>疑是银河落九天</p>
    </div>
    <style>
        .poem {
            writing-mode: vertical-rl;
            margin: 50px auto;
            letter-spacing: 5px;
        }

        .year .author {

            margin-bottom: 20px;
            text-combine-upright: none;

        }
        h1{
            text-align: center;
        }
        

        .year {
            text-align: end;
            margin-right: -15px;
            font-size: 12px;
            color: #666;
        }

        .year span {
            text-orientation: upright;

            text-combine-upright: all;
        }

        p {
            font-size: 20px;
            letter-spacing: 10px;
        }
    </style>

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值