gpt4 book ai didi

html - 如何使用 HTML 表格并使多行只有一个 ?

转载 作者:行者123 更新时间:2023-11-27 23:28:24 29 4
gpt4 key购买 nike

我需要更改 html <table>为了使其响应,但我只想与 css 一起工作

table{
width:100px;
height:100px;
background:green;
}

.a{
width:100% !important;
background-color:Red;

}
<table>
<tbody>
<tr>
<td class="a">AAA</td>
<td class="b">BBB</td>
<td class="c">CCC</td>
</tr>

</tbody>
</table>

我想要什么:

在不更改 HTML 的情况下,我想要屏幕 100% 宽度的 AAA,以及下方的“BBB”+“CCC”(在带有 BBB 的 AAA 行下:50% 宽度,以及“CCC”也在宽度)

我正在尝试但没有成功,有什么帮助吗?

最佳答案

您反对更改 table 的默认 display: table; 吗?

如果没有,你可以这样做

.a{
width:100%;
background-color:Red;
}
.b, .c { width: 49%; display: inline-block }


table, tbody, tr, td { display: block; }

Fiddle

关于html - 如何使用 HTML 表格并使多行只有一个 <tr>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37236788/

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