Html 表格标题上的按钮
我有一个旧站点的问题,我需要在div元素中放置一个按钮,但是要放在表的顶部Html 表格标题上的按钮,html,css,html-table,Html,Css,Html Table,我有一个旧站点的问题,我需要在div元素中放置一个按钮,但是要放在表的顶部 <div class="panel2" style="border: 1px solid red;"> <div id="charInfo"> <input type="button" id="lockList" name="lockList" value="Lock WL" /> <table width="500px" style="b
<div class="panel2" style="border: 1px solid red;">
<div id="charInfo">
<input type="button" id="lockList" name="lockList" value="Lock WL" />
<table width="500px" style="border:1px solid #000;border-collapse:collae;font-familyrif;font-size:80%;">
<caption style="font-size:140%;padding:5px;">Wish list status <b>Tyde</b>
</caption>
<thead>
<tr>
<th scope="col">Zone name</th>
<th scope="col">Wish Items</th>
<th scope="col">Received</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<tr></tr>
<tr>
<th scopre="row">Heart of Fear</th>
<td align="center">22</td>
<td align="center">0</td>
<td align="center" style="color:Green;"><b>Active</b>
</td>
</tr>
<tr>
<th scopre="row">Mogu-shan Vaults</th>
<td align="center">27</td>
<td align="center">4</td>
<td align="center" style="color:Green;"><b>Active</b>
</td>
</tr>
<tr>
<th scopre="row">Throne of Thunder</th>
<td align="center">45</td>
<td align="center">0</td>
<td align="center" style="color:Green;"><b>Active</b>
</td>
</tr>
<tr>
<th scopre="row">Throne of Thunder (Heroic)</th>
<td align="center">5</td>
<td align="center">1</td>
<td align="center" style="color:Red;"><b>Not locked</b>
</td>
</tr>
</tbody>
</table>
</div> </div>
愿望清单状态
区域名称
愿望物品
收到
地位
恐惧之心
22
0
活跃的
磨谷山金库
27
4.
活跃的
雷电王座
45
0
活跃的
雷霆宝座(英雄)
5.
1.
未锁定
我这里有一个例子
正如您所看到的,按钮被放置在右侧,但我想将其放置在表格标题的顶部。可以这样做吗?如果可以,怎么做?这是我想要的水
你可以这样做 CSS HTML
愿望列表状态类型
演示:指的是您提供的小提琴链接, 移除<代码>浮动:右侧代码>来自
锁列表
css类
#lockList {width:auto;margin:auto;position: relative;}
检查下面的CSS
#lockList
{
width:auto;
}
#charInfo
{
position: absolute;
text-align: center;
}
和小提琴使用
position:absolute
按钮,左键为450px
。对于#charInfo
使用位置:相对。这是行不通的。按钮与页面对齐,而不是与div对齐。因此,当页面更改时,按钮不会调整。如果表格只有300像素,则按钮不再显示在标题上。另一种解决方案:在表格顶部添加无边框的行,并将按钮放置在最后一个单元格中。我不需要将其显示在行的顶部。我需要它被显示在哪里标题是在文本的右侧网站。博顿是在右上角,因为我之前阴影它。所以它不在标题上。
#lockList {width:auto;margin:auto;position: relative;}
#lockList
{
width:auto;
}
#charInfo
{
position: absolute;
text-align: center;
}