在HTML

时间:2018-03-15 11:22:58

标签: html html-table

我编写了以下代码,以便在显示和隐藏内容之间切换。这很好。



<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Simple collapsible</button>
  <div id="demo" class="collapse in">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  </div>
&#13;
&#13;
&#13;

是否可以用 tds 替换 div 内容?

<td></td>
<td></td>
<td></td>
<td></td>

2 个答案:

答案 0 :(得分:1)

你试过吗?

似乎工作正常。

&#13;
&#13;
<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Simple Collapsible</h2>
  <p>Click on the button to toggle between showing and hiding content.</p>
  <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Simple collapsible</button>
  <div id="demo" class="collapse">
    <td>test</td>
    <td>test</td>
    <td>test</td>
    <td>test</td>
  </div>
  
</div>

</body>
</html>
&#13;
&#13;
&#13;

答案 1 :(得分:-1)

5