javascript - 如何垂直书写/显示文本?

标签 javascript jquery html css

我正在尝试按照如下所述转换文本。

02比赛日

0
2
M
a
t
c
h
d
a
y

我的代码如下。当前结果并不像我想要的那样准确。 请建议我。

table {border-collapse:collapse;}
 td span {display:block;}
.sideways {
	-webkit-transform: rotate(90deg);	
	-moz-transform: rotate(270deg);
	-ms-transform: rotate(270deg);
	-o-transform: rotate(270deg);
	transform: rotate(270deg);
}
/*put specifics here*/
table tr:nth-of-type(1) td:nth-of-type(1) {background-color:tomato;}
table tr:nth-of-type(1) td:nth-of-type(2) {background-color:red;}
table tr:nth-of-type(1) td:nth-of-type(3) {background-color:chocolate;}
table tr:nth-of-type(1) td:nth-of-type(4) {background-color:black;}
table tr:nth-of-type(1) td:nth-of-type(5) {background-color:grey;}
<table>
  <tr>
    <td rowspan="3"><span class="sideways">O2 Matchday</span></td>
  </tr>
  <tr>
    <td>My O2 for Windows</td>
  </tr>
  <tr>
    <td colspan="2">Blipdrop</td>
    <td>My O2 for business</td>
  </tr>
  
</table>

最佳答案

你可以试试这个: http://jsfiddle.net/lotusgodkk/GCu2D/1013/

CSS:

div {
    font-size: 20px;
    width: 15px;
    overflow: hidden;
    word-break: break-all;
    text-align: center;
}

HTML:

    <div>Sample Text</div>

关于javascript - 如何垂直书写/显示文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34542233/

相关文章:

javascript - 使用纯 JavaScript 获取 DOM 元素值

javascript - Cookie 在 HttpResponseMessage 中可见,但在 Javascript 中不可见

php - php中是否可以有一个javascript函数

javascript - 如何使用相同的javascript函数选择和序列化不同形式的数据

javascript - 滚动窗口/区域中没有跳跃拖动/调整对话框大小?

javascript - 月、周、日标题栏按钮点击回调?

javascript - 谁能告诉我如何在centos中打开扩展名为.dat的文件?

javascript - 导航箭头在 fancybox 中不起作用

javascript - 视频 html5 元素上的播放事件是什么?

javascript - WordPress 主题 : JavaScript not working