gpt4 book ai didi

html - css 跨表列垂直旋转文本

转载 作者:行者123 更新时间:2023-11-28 16:54:25 25 4
gpt4 key购买 nike

我有一个矩阵,由于主题名称,它正在屏幕外拉伸(stretch)我希望创建一个训练矩阵,左边的能力是获得技能的彩色单元格,主题名称垂直跨列。 enter image description here

我曾尝试使用 bootstrap 和 css 规则来旋转​​文本,但我无法让文本漂浮在网格上方

抱歉,这是我试过的:

  <style>
.rotate {

transform: rotate(90deg);
width: 8rem;
}
</style>

</head>
<body>


<div class="row">

<div class="col">

<table class="table">
<tr> <td> </td>
<tr> <td> <p class="text-nowrap bd-highlight rotate ">Bruce Wayne. </p> </td>

<tr> <td> <p class="text-nowrap bd-highlight rotate ">Clark Kent.</p> </td>

<tr> <td> <p class="text-nowrap bd-highlight rotate ">Barry Allen.</p> </td>
</tr>


<tr> <td> Detective</td> <td class="table-success"> </td> <td class="table-success"></td> <td class="table-success"></td> </tr>
<tr> <td> can fly</td> <td class="table-success"> </td> <td class="table-success"></td> <td class="table-success"></td> </tr>
<tr> <td> runs fast</td> <td class="table-success"> </td> <td class="table-success"></td> <td class="table-success"></td> </tr>
<tr> <td> plays well</td> <td class="table-success"> </td> <td class="table-success"></td> </tr>


</table>

所有垂直文本都堆叠在屏幕左侧。

最佳答案

这是你想要的吗?

.table {
background: grey;
border-spacing: 5px;
border: none;
width: 500px;
}

.rotate {
transform: rotate(90deg);
width: 8rem;
}

td {
width: 25%;
border: 2px solid black;
padding: 10px;
position: relative;
}

.vertical {
transform: rotate(90deg);
position: absolute;
top: 200%;
left: 0;
right: 0;
color: #fff;
font-weight: bold;
font-size: 18px;
text-transform: uppercase;
white-space: nowrap;
}

.
<body>


<div class="row">

<div class="col">

<table class="table">
<tr>
<td> Detective</td>
<td class="table-success"><span class="vertical"> Bruce Wayne</span> </td>
<td class="table-success"><span class="vertical"> clark Kent</span></td>
<td class="table-success"><span class="vertical"> barry allen</span></td>
</tr>
<tr>
<td> can fly</td>
<td class="table-success"> </td>
<td class="table-success"></td>
<td class="table-success"></td>
</tr>
<tr>
<td> runs fast</td>
<td class="table-success"> </td>
<td class="table-success"></td>
<td class="table-success"></td>
</tr>
<tr>
<td> plays well</td>
<td class="table-success"> </td>
<td class="table-success"></td>
<td class="table-success"></td>
</tr>


</table>

关于html - css 跨表列垂直旋转文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57669830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com