在报头列中的标签垂直文本(vertically text for the label in the

2019-09-24 07:39发布

I am trying to make a table with Vertical Text just on the header table.

Here is my CSS code:

table th.user {
  .rotate(90deg);
  position: relative;
  padding-top: 190px;
  top: -10px;
  right: 0px;
  width: 200px;
}

Here is the demo http://codepen.io/anon/pen/GnveJ

As you can see it works partially. I would like to have the columns (the cells of the column where there are the name) which width fits exactly the contents (about 50 px); the same as the pic I attached to this question.
Any idea what is the best way to make the css code or js code for this purpose?

Requirement:
I am using less and jquery

Answer 1:

包裹的用户名的span ,即旋转,并设置一个width上的细胞。 如果旋转细胞,它旋转文本之前该表将显示它的大小。

table th.user span{
  display:block;
  .rotate(90deg);
  padding: 190px 0 0 0;
  position: relative;
  left: 20px;
  width: 200px;
}
.user, tbody td {
  max-width: 50px;
}

演示



文章来源: vertically text for the label in the header column