CSS Table 样式 - 尝试提供更多 space
CSS Table Styles - Trying to give more space
大家好,
我正在用 CSS 和 jQuery 以及 PHP 编写一个 Wordpress 插件。
我有下面的 table,我正在尝试修改 CSS,但它似乎没有正确应用。我的 table 基本上是这样的:
|--------------------------------------------|
| Username: |
|--------------------------------------------|
| |
|--------------------------------------------|
|Email |
|--------------------------------------------|
||------------------------------------------||
||Year | Month | Day ||
|| | | ||
||------------------------------------------||
|--------------------------------------------|
真的很浓缩,我想给它更多space更多类似的东西:
|--------------------------------------------|
| |
| Username: |
| |
|--------------------------------------------|
| |
| |
| |
|--------------------------------------------|
| |
|Email |
| |
|--------------------------------------------|
||------------------------------------------||
||Year | Month | Day ||
|| | | ||
||------------------------------------------||
|--------------------------------------------|
当我执行以下操作时 CSS:
.registration table td {
border: 0;
padding-bottom: 100px;
}
它改变了 tables "INSIDE" 另一个 Table,但它没有改变主要 Table 谁能帮我解决我的错误,因为我需要比这更好的造型......
<form id="registration" action="" method="POST">
<table class="registration_table">
<tbody>
<tr id="reg_tablerow_1">
<div class="regpage_text required" id="order_1">
<label for="username">Username: *</label>
<br>
<input id="username" name="username" value="" placeholder="Username" type="text">
</div>
</tr>
<tr>
<td>
<table>
<tbody>
<tr>
<td>Year</td>
<td>Month</td>
<td>Day</td>
</tr>
<tr>
<td>
<select name="year" id="year">
<option value="2015" selected="selected">2015</option>
<option value="2014">2014</option>
</select>
</td>
<td>
<select name="month" id="month">
<option value="1" selected="selected">January</option>
<option value="2">February</option>
</select>
</td>
<td>
<select name="day" id="day">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
</select>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</form>
编辑更新
Brett 的答案是最接近正确的答案,但是如果你仔细观察我的 HTML 就会发现缺少一些 TD,这会导致 padding-bottom 不起作用。
我不得不检查我的脚本和所有 html 才意识到错误的复制/粘贴让我在没有
的情况下复制了一些信息
您没有 class 注册,但在您的表格上进行了 id 注册。
在表格中添加class或将css修改为
#registration table td {
border: 0;
padding-bottom: 100px;
}
对于垂直居中使用这个:
vertical-align: middle; Or bottom Or Top
水平居中使用这条线:
text-align: center; Or left Or right
对于身高问题使用:
height: 00px; & line-height: 00px;
大家好,
我正在用 CSS 和 jQuery 以及 PHP 编写一个 Wordpress 插件。
我有下面的 table,我正在尝试修改 CSS,但它似乎没有正确应用。我的 table 基本上是这样的:
|--------------------------------------------|
| Username: |
|--------------------------------------------|
| |
|--------------------------------------------|
|Email |
|--------------------------------------------|
||------------------------------------------||
||Year | Month | Day ||
|| | | ||
||------------------------------------------||
|--------------------------------------------|
真的很浓缩,我想给它更多space更多类似的东西:
|--------------------------------------------|
| |
| Username: |
| |
|--------------------------------------------|
| |
| |
| |
|--------------------------------------------|
| |
|Email |
| |
|--------------------------------------------|
||------------------------------------------||
||Year | Month | Day ||
|| | | ||
||------------------------------------------||
|--------------------------------------------|
当我执行以下操作时 CSS:
.registration table td {
border: 0;
padding-bottom: 100px;
}
它改变了 tables "INSIDE" 另一个 Table,但它没有改变主要 Table 谁能帮我解决我的错误,因为我需要比这更好的造型......
<form id="registration" action="" method="POST">
<table class="registration_table">
<tbody>
<tr id="reg_tablerow_1">
<div class="regpage_text required" id="order_1">
<label for="username">Username: *</label>
<br>
<input id="username" name="username" value="" placeholder="Username" type="text">
</div>
</tr>
<tr>
<td>
<table>
<tbody>
<tr>
<td>Year</td>
<td>Month</td>
<td>Day</td>
</tr>
<tr>
<td>
<select name="year" id="year">
<option value="2015" selected="selected">2015</option>
<option value="2014">2014</option>
</select>
</td>
<td>
<select name="month" id="month">
<option value="1" selected="selected">January</option>
<option value="2">February</option>
</select>
</td>
<td>
<select name="day" id="day">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
</select>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</form>
编辑更新
Brett 的答案是最接近正确的答案,但是如果你仔细观察我的 HTML 就会发现缺少一些 TD,这会导致 padding-bottom 不起作用。
我不得不检查我的脚本和所有 html 才意识到错误的复制/粘贴让我在没有
的情况下复制了一些信息您没有 class 注册,但在您的表格上进行了 id 注册。
在表格中添加class或将css修改为
#registration table td {
border: 0;
padding-bottom: 100px;
}
对于垂直居中使用这个:
vertical-align: middle; Or bottom Or Top
水平居中使用这条线:
text-align: center; Or left Or right
对于身高问题使用:
height: 00px; & line-height: 00px;