css 文字垂直_CSS垂直文字

css 文字垂直

Almost every HTML element we create is thought of in the frame of horizontal.  We pay much more attention to widths than we do heights, especially when it comes to text within them. Sometimes we do, however, want to display element text in a vertical fashion.  In the old days of crippled Internet Explorers, this was mostly a losing battle.  These days, however, vertical text is a breeze.  Here's how to do it!

我们创建的几乎每个HTML元素都被视为水平框架。 我们对宽度的关注比对高度的关注要多得多,尤其是当涉及到其中的文本时。 但是,有时候我们确实希望以垂直方式显示元素文本。 在残破的Internet Explorer的早期,这主要是一场失败的战斗。 但是,如今,垂直文本变得轻而易举。 这是怎么做!

CSS (The CSS)

Vertical text is accomplished easily these days with CSS transforms:

如今,使用CSS转换可以轻松完成垂直文本:


.vertical-text {
	transform: rotate(90deg);
	transform-origin: left top 0;
}


Depending on which direction you'd like the text to display vertically, the rotation will be different, but it's that rotate value which will make the text vertical.  Here's a helpful tip:

根据您希望文字垂直显示的方向,旋转角度会有所不同,但是正是旋转值使文字垂直。 这是一个有用的提示:


.vertical-text {
	float: left;
}


Floating the element will essentially emulate an auto width!

浮动元素实际上将模拟自动宽度!

CSS transforms make loads possible, and are much more powerful than simply turning text vertical, but with the code provided above, the job is done.  Isn't progress grand?

CSS转换使加载成为可能,并且比简单地垂直转换文本要强大得多,但是使用上面提供的代码,这项工作就完成了。 进步不是很大吗?

翻译自: https://davidwalsh.name/css-vertical-text

css 文字垂直

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值