【发布时间】:2015-12-02 14:42:23
【问题描述】:
我刚开始自学 HTML 和 CSS,掌握了一些通用规则,它变得越来越容易,但我无法理解这一点。我写这个只是为了了解表格和行,但除非我使用,否则不应用边框属性
.city th {
但即使只使用了背景属性和颜色
.city {
这是我编写的基本代码,我想知道是否有一些我遗漏的简单内容或我没有正确理解的内容。
<head>
<style>
.even {
background-color: blue;
}
.city th {
border-top: 5px solid red;
border-top-left-radius: 5px;
background-color: gray;
color: white;
}
</style>
</head>
<body>
<h1>Poetry Workshops</h1>
<p>We will be conducting a number of poetry workshops and symposiums
throughout the year.</p>
<p>Please note that the following events are free to members:</p>
<div class="list">
<ul>
<li>A poetic Perspective</li>
<li>Walt WHitman at War</li>
<li>Found Poems and Outsider Poetry</li>
</ul>
</div>
<table>
<tr class="city">
<th></th>
<th>New York</th>
<th>Chicago</th>
<th>San Francisco</th>
</tr>
<tr>
<td>A poetic perspective</td>
<td>Sat, 4 Feb 2012 11am - 2pm</td>
<td>Sat, 3 Mar 2012 11am - 2pm</td>
<td>Sat, 17 Mar 2012 11am - 2pm</td>
</tr>
<tr class="even">
<td>Walt Whitman at War </td>
<td>Sat, 7 Apr 2012 11am - 1pm</td>
<td>Sat, 7 Apr 2012 11am - 1pm</td>
<td>Sat, 7 Apr 2012 11am - 1pm</td>
</tr>
<tr>
<td>Found Poems & Outsider Poetry</td>
<td>Sat, 7 Apr 2012 11am - 1pm</td>
<td>Sat, 7 Apr 2012 11am - 1pm</td>
<td>Sat, 7 Apr 2012 11am - 1pm</td>
</tr>
<tr class="even">
<td>Natural Death: An Exploration</td>
<td>Sat, 7 Apr 2012 11am - 1pm</td>
<td>Sat, 7 Apr 2012 11am - 1pm</td>
<td>Sat, 7 Apr 2012 11am - 1pm</td>
</tr>
</table>
【问题讨论】:
-
margin, padding & border 不能申请
tr,所以你必须给它设置样式 -
谢谢。我一直卡在这些小事情上,而明确的解释会有所帮助。