html - css如何对齐标题旋转表

标签 html css

我需要用 css 旋转标题表并将所有文本放在一起 这是我的 CSS

th.rotate {
  height: 100px;
  white-space: nowrap;
}

th.rotate>div {
  transform: rotate(-90deg);
}
       
  			<th class="rotate"><div>Tintoria</div></th>
                    <th class="rotate"><div>Mag.Tops</div></th>
                    <th class="rotate"><div>Mag.Filati</div></th>                            
                    <th class="rotate"><div>Orditura</div></th>
                    <th class="rotate"><div>Tessitura</div></th>
                    <th class="rotate"><div>Ramm./Contr.</div></th>
                   

现在这是结果 enter image description here

我的问题是:我怎样才能将按钮之间的所有空格减少到 0???

我的目标是:enter image description here

最佳答案

使用书写模式:

The writing-mode CSS property defines whether lines of text are laid out horizontally or vertically, as well as the direction in which blocks progress.

MDN

th.rotate {
  white-space: nowrap;
}

th.rotate div {
  height: 100px;
  padding: 0.25em;
  writing-mode: vertical-lr;
  transform: rotate(-180deg);
  border: 1px solid grey;
  border-radius: 4px;
  background: #ccc;
}
<table>
  <th class="rotate">
    <div>Tintoria</div>
  </th>
  <th class="rotate">
    <div>Mag.Tops</div>
  </th>
  <th class="rotate">
    <div>Mag.Filati</div>
  </th>
  <th class="rotate">
    <div>Orditura</div>
  </th>
  <th class="rotate">
    <div>Tessitura</div>
  </th>
  <th class="rotate">
    <div>Ramm./Contr.</div>
  </th>
</table>

关于html - css如何对齐标题旋转表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49048521/

相关文章:

html - 并排两个表格,填充剩余宽度

html - 如何在 100% 宽度的 div 中水平居中绝对定位元素?

html - Bootstrap v4-Alpha 6 | .float-lg-right 不工作

html - 导航栏 - 每个按钮都在单独的一行,我该如何解决?

html - 为什么我的菜单没有对齐?

javascript:将温度映射到特定的 HSL 色调值

html - 使用有效和无效通知和符号进行表单验证

java - 如何使用java提取html表中特定td内的数据

javascript - 如何使用javascript根据输入值突出显示相关数字范围?

html - 如何在 WordPress HTML 中包含 "onclick"对象