Gibt es andere Lösungen für das Problem, dass colspan="1.5" nicht funktioniert?
P粉368878176
P粉368878176 2024-03-30 09:12:41
0
1
411

Das ist der Tisch, den ich brauche Ich schaffe es problemlos, die erste und zweite Reihe zu bekommen, aber wenn ich versuche, die dritte Reihe gut zu machen, zerbreche ich die zweite Reihe.

Ich habe versucht, das Attribut width und colspan zu verwenden, aber nichts hat funktioniert.

<table border="1px" width="100%">
        <tr>
            <td colspan="6">Cell 1</td>
        </tr>
        <tr >
            <td colspan="3">Cell 2</td> 
            <td colspan="3" >Cell 3</td>
        </tr>
        <tr>
            <td colspan="2">Cell 4</td> 
            <td colspan="2">Cell 5</td>            
            <td colspan="2">Cell 6</td> 
        </tr>
    </table>

P粉368878176
P粉368878176

Antworte allen(1)
P粉262073176

<table> 默认情况下会符合其内容,因此不需要每列的宽度相等。因此,通过将 table-layout:fixed 分配给 <table> 来手动分配相等的列宽度,然后通过将每个宽度分配给第一个 < 的 <thead> 中的 <th> 来为每列分配相等的宽度。 tr> 或缺少为第一个 <tr><td> 分配宽度(当然 tdth 作为选择器也可以),请参见下面的示例。

table {
  table-layout: fixed;
}

td {
  width: 16.5%;
  text-align: center;
}

I
II III
IV V VI
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!