当鼠标悬停在表格上时,复选框会向左移动
when hover over the table the checkBoxes move to left
我的mvc应用程序与4个属性的表,我使用的功能悬停的表要显示一些按钮,当我悬停在表格上时,我看到按钮,但所有的复选框都是移动位靠近name属性,有一种方法可以避免复选框的移动悬停在表格上
<form autocomplete="off">
@* Button for adding some user *@
<div class="text-right">
<a href="#" id="addRow"><i class="glyphicon glyphicon-plus"></i> new</a>
</div>
@* List of users *@
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.name)
</th>
<th>
@Html.DisplayNameFor(model => model.checkBox1)
</th>
<th>
@Html.DisplayNameFor(model => model.checkBox2)
</th>
<th>
@Html.DisplayNameFor(model => model.checkBox3)
</th>
<th></th>
</tr>
</thead>
<tbody id="dataTable">
<tr id="emptyRow" style="display: none;">
<td>@Html.TextBox("name")</td>
<td>@Html.CheckBox("checkBox1")</td>
<td>@Html.CheckBox("checkBox2")</td>
<td>@Html.CheckBox("checkBox3")</td>
<td>
<span class="actions-default" style="display:none;">
@Html.ActionLink("Edit", "Edit", new { id = -1 }, new { @class = "btn-edit" }) |
@Html.ActionLink("Delete", "Delete", new { id = -1 }, new { @class = "btn-delete" })
</span>
<span class="actions-editable">
<input type="submit" value="Create" class="btn btn-default btn-create" />
<input type="submit" value="Cancel" class="btn btn-default btn-cancel" />
</span>
</td>
</tr>
@foreach (var item in Model)
{
<tr data-id="@item.Id">
<td>
@Html.DisplayFor(modelItem => item.name)
</td>
<td>
@Html.DisplayFor(modelItem => item.checkBox1)
</td>
<td>
@Html.DisplayFor(modelItem => item.checkBox2)
</td>
<td>
@Html.DisplayFor(modelItem => item.checkBox3)
</td>
<td>
<span class="actions-default">
@Html.ActionLink("Edit", "Edit", new { id = item.Id }, new { @class = "btn-edit" }) |
@Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { @class = "btn-delete" })
</span>
<span class="actions-editable" style="display:none;">
<input type="submit" value="Update" class="btn btn-default btn-update" />
<input type="submit" value="Cancel" class="btn btn-default btn-cancel" />
</span>
</td>
</tr>
}
</tbody>
</table>
</form>
这是表格悬停的css代码
#dataTable .actions-default {
display: none;
}
#dataTable:hover .actions-default {
display: block;
}
这可能是因为当您显示按钮时,表格单元格变得更宽,因此每个其他列调整其大小以匹配您的容器宽度。
尝试给你的列一个宽度
这可能是因为span是一个内联元素,悬停样式应该看起来像这样,以更好地控制元素:
#dataTable:hover .actions-default {
display: inline;
}
Set display inline-block
CSS#dataTable .actions-default {
display: inline-block;
}
#dataTable:hover .actions-default {
/* Set color text, background color...whatever */
color: red; /* example */
}
演示
相关文章:
- 如何在angularJS中编辑时,如果DB中的值为true,则设置复选框,如果值为false,则取消选中复选框
- 正在验证8个真/假复选框或复选框中的2个
- 为复选框javascript指定两个值
- 如何在单击复选框后调用控制器方法
- 从复选框和Selects-KnockoutJS中获取值的总和
- 选中多个具有相同名称的复选框
- 使用Jquery选择或取消选择ListView中的所有复选框
- Jquery表单验证插件-如果选中复选框,如何在提交时执行某些操作
- 使用$.ajax发布多个复选框
- AngularJS单选筛选不适用于Name、Description和Field4复选框值
- 使用jquery选中/取消选中单个复选框
- Angular JS Filter-通过3个复选框进行筛选
- 如果选中了多个复选框,如何添加事件
- 在加载/移除复选框到数组上有问题
- 在嵌套的HTML列表中,将复选框向左对齐
- 如果复选框被选中,则移除类
- 在angularjs中动态地向复选框添加/移除checked属性
- 当鼠标悬停在表格上时,复选框会向左移动
- 如何将类添加到选中的复选框中,其他复选框已移除活动
- 如果复选框disable为true,则移除类