Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 211 additions & 0 deletions table_nested.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>练习:表格嵌套与拼合</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
margin: 20px;
padding: 20px;
}

.container {
background-color: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
max-width: 800px;
}

h1 {
color: #666;
font-size: 24px;
margin-bottom: 10px;
}

.subtitle {
color: #999;
font-size: 14px;
margin-bottom: 30px;
}

.content-wrapper {
display: flex;
gap: 40px;
align-items: flex-start;
}

.table-container {
flex: 1;
}

.info-panel {
flex: 1;
background-color: #f8f8f8;
padding: 20px;
border-radius: 8px;
}

.main-table {
border-collapse: collapse;
border: 2px solid #333;
width: 300px;
height: 300px;
}

.main-table td {
border: 2px solid #333;
text-align: center;
vertical-align: middle;
font-size: 18px;
font-weight: bold;
position: relative;
}

.cell-1, .cell-2, .cell-3 {
width: 100px;
height: 80px;
}

.cell-nested {
width: 200px;
height: 200px;
padding: 0;
}

.cell-4, .cell-5 {
width: 100px;
height: 100px;
}

.nested-table {
width: 100%;
height: 100%;
border-collapse: collapse;
border: none;
}

.nested-table td {
border: 2px solid #333;
text-align: center;
vertical-align: middle;
font-size: 16px;
font-weight: bold;
}

.nested-8, .nested-7, .nested-10 {
width: 50px;
height: 40px;
}

.nested-9 {
width: 50px;
height: 80px;
}

.nested-6 {
width: 50px;
height: 40px;
}

.info-section {
margin-bottom: 20px;
}

.info-title {
color: #999;
font-size: 14px;
margin-bottom: 10px;
}

.tag {
background-color: #e0e0e0;
padding: 4px 8px;
border-radius: 4px;
font-family: monospace;
font-size: 12px;
margin-right: 8px;
margin-bottom: 4px;
display: inline-block;
}

.key-points {
color: #333;
font-size: 14px;
line-height: 1.6;
}

.key-points li {
margin-bottom: 8px;
}
</style>
</head>
<body>
<div class="container">
<h1>练习:表格嵌套与拼合</h1>
<p class="subtitle">写出程序代码,实现表格在浏览器中的显示</p>

<div class="content-wrapper">
<div class="table-container">
<table class="main-table">
<tr>
<td class="cell-1">1</td>
<td class="cell-2">2</td>
<td class="cell-3">3</td>
</tr>
<tr>
<td class="cell-nested" colspan="2">
<table class="nested-table">
<tr>
<td class="nested-8">8</td>
<td class="nested-9" rowspan="2">9</td>
</tr>
<tr>
<td class="nested-7">7</td>
</tr>
<tr>
<td class="nested-10">10</td>
<td class="nested-6">6</td>
</tr>
</table>
</td>
<td class="cell-4">4</td>
</tr>
<tr>
<td colspan="2"></td>
<td class="cell-5">5</td>
</tr>
</table>
</div>

<div class="info-panel">
<div class="info-section">
<div class="info-title">html标签:</div>
<span class="tag">table</span>
<span class="tag">tr</span>
<span class="tag">td</span>
</div>

<div class="info-section">
<div class="info-title">关键属性:</div>
<div class="key-points">
table - border<br>
td - colspan, rowspan
</div>
</div>

<div class="info-section">
<div class="info-title">关键点:</div>
<ul class="key-points">
<li>2个表格嵌套,嵌套在td标记中完成;</li>
<li>行列单元格的拼合</li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>