gpt4 book ai didi

html - 我想让这个表中的行可折叠/展开

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

在这里找到代码,不想粘贴整个东西... https://code.sololearn.com/W8odKz78WT07/#html

或者作为例子,让我们使用这个

<head>

</head>

<body>
<table>
<tr>
<th></th>
<th><img class="isaaccrm" src="http://isaacintelligence.com/wp-content/uploads/2017/04/ISAAC-logo-cropped.png"/></th>
<th><img class="zoho" src="http://i.imgur.com/R8vz9iG.png"/></th>
<th><img class="salesforce" src="http://i.imgur.com/UhUHB4P.png"/></th>
<th><img class="infusionsoft" src="http://i.imgur.com/iGzEnUr.png"/> </th>
<th><img class="sugarcrm" src="http://i.imgur.com/weilyrP.png"/></th>
</tr>

<tr>
<th> <p class="comparisons">Operating Systems</p>
<td class="center">Web</td>
<td class="center">Web</td>
<td class="center">Web</td>
<td class="center">Web</td>
<td class="center">Web</td>
</th>

</tr>
<th><p class="comparisons">Mobile compatibility</p>
<td><img style="padding-left:20px" title="iOS and Android" src="http://isaacintelligence.com/wp-content/uploads/2017/04/New-iOS-and-Android-1.png"></td>
<td><img style="padding-left:30px" title="iOS, Android and Windows" src="http://isaacintelligence.com/wp-content/uploads/2017/04/New-iOS-and-Android-and-Windows-1.png"></td>
<td><img style="padding-left:30px" title="iOS, Android and Windows" src="http://isaacintelligence.com/wp-content/uploads/2017/04/New-iOS-and-Android-and-Windows-1.png"></td>
<td><img style="padding-left:20px" title="iOS and Android" src="http://isaacintelligence.com/wp-content/uploads/2017/04/New-iOS-and-Android-1.png"></td>
<td><img style="padding-left:60px" title="iOS, Android and Windows" src="http://isaacintelligence.com/wp-content/uploads/2017/04/New-iOS-and-Android-and-Windows-1.png"></td>
</th>
</tr>

正在应用的 CSS:

.isaaccrm {
float: left;
height: 20px;
width: 100px;
}

.zoho {
height: 50px;
width: 115px;
padding-top: 10px;
float: right;
margin-right: 30px;

}

.salesforce {
height: 60px;
width: 90px;
padding-top: 10px;
padding-left: 20px;
}

.infusionsoft {
height: 25px;
width: 180px;
padding-top: 5px;
}

.sugarcrm {
height: 60px;
width: 90px;
padding-top: 10px;
margin-right: 55px;
float: right;
}

.comparisons {

margin-top: 30px;
margin-bottom: 30px;
/* Make the comparison font into Lato*/

}

有什么方法可以使这些行可折叠,同时显示行的名称(<p> 标记,所以只需折叠所有 <td> ),同时仅使用 HTML/CSS?还是我必须包含 JavaScript?

最佳答案

您可以使用 input:checked 实现此目的,类似于 Collapse and expand elements with CSS

您必须将所有 input 标签放在表格之前,然后放置 label 标签,例如每行中每个第一个单元格的内部。 inputlabel 标签需要 id/for 属性。

关于html - 我想让这个表中的行可折叠/展开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43656249/

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