html - 为什么 padding-bottom 不能向上移动元素?
问题描述
我正在尝试将橙色加号(屏幕右下方)向上移动,使其更靠近其他图标,位于它们的正下方。Padding-bottom 不起作用,但 padding-top 可以。我认为它上面的元素必须有很多填充,使其无法向上移动,但检查器工具显示它们之间存在空间。
我很难知道这里发生了什么,因为我的导师编写了这段代码,因此我不知道它是如何构造的。我对 Html/Css 也很陌生,尽管 padding-bottom 到目前为止还没有让我失望。
这是构成第二个表的部分视图代码。橙色加号图标位于最底部,表格结束标记下方:
@model IEnumerable<JobPlacementDashboard.Models.JPOutsideNetworking>
}
<table class="table">
<tr>
<th class="sort-button-style table-headers fixed">
<a onclick="sortPartial('@ViewBag.NameSortParm')">Name</a>
</th>
<th class="sort-button-style table-headers fixed">
<a onclick="sortPartial('@ViewBag.PositionSortParm')">Position</a>
</th>
<th class="sort-button-style table-headers fixed ">
<a onclick="sortPartial('@ViewBag.CompanySortParm')">Company</a>
</th>
<th class="sort-button-style table-headers fixed">
<label class="network-label networkingheader">LinkedIn</label>
</th>
<th class="sort-button-style table-headers fixed">
<a onclick="sortPartial('@ViewBag.LocationSortParm')">Location</a>
</th>
<th class="sort-button-style table-headers fixed">
<label class="network-label networkingheader">Email</label>
</th>
<th class="sort-button-style table-headers fixed">
<a onclick="sortPartial('@ViewBag.StackSortParm')">Stack</a>
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr class="text-center">
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Position)
</td>
<td>
<a href="http://@Html.ExternalLink(item.CompanyURL)" target="_blank">@Html.DisplayFor(modelItem => item.Company)</a>
</td>
<td>
<a href="http://@Html.ExternalLink(item.LinkedIn)" target="_blank">LinkedIn</a>
</td>
<td>
@Html.DisplayFor(modelItem => item.Location)
</td>
<td>
<a href="mailto:@Html.ExternalLink(item.Contact)" target="_blank">@Html.DisplayFor(modelItem => item.Contact)</a>
</td>
<td>
@Html.DisplayFor(modelItem => item.Stack)
</td>
<td class="font20">
@if (User.IsInRole("Admin"))
{
@Html.ActionLink(HttpUtility.HtmlDecode("✎"), "Edit", new { id = item.OutsideNetworkingID })
<span>|</span>
@Html.ActionLink(HttpUtility.HtmlDecode("🗑"), "Delete", new { id = item.OutsideNetworkingID })
}
</td>
</tr>
}
</table>
@if (User.IsInRole("Admin"))
{
<div class="createnewplus">
@Html.ActionLink(HttpUtility.HtmlDecode("+"), "Create")
</div>
}
这是针对加号的CSS部分:
.createnewplus {
font-size:30px;
font-weight:800;
margin-left:1075px;
}
左边距是因为当它需要位于其他图标下方时,它会自动显示在最左边的学生姓名下方。
如果有人知道为什么 padding-bottom 在这种情况下不起作用,我将不胜感激。如果这是一个非常愚蠢的问题,我深表歉意;如果您需要更多详细信息才能知道发生了什么,请告诉我!
编辑: padding-bottom 目前不在 css 中,因为我把它拿出来了,因为它什么也没做。
解决方案
Padding-bottom 将在 createnewplus div 下方创建空间(填充),因此将其之后的任何内容移动到页面下方。看起来 createnewplus div 是页面上的最后一个元素,这就是为什么添加 padding-bottom 时没有任何变化的原因。
您需要找到负责每个表后面的填充/边距的 css。降低它会将您的图标向上移动。
推荐阅读
- email - 在 tcltk 中发送电子邮件
- vba - 如何在特定单元格开始搜索
- mysql - 如何在 MySQL 中获取包含某些字符的所有单词?
- javascript - 如何根据包含的值(定义的最小值、平均值、最大值)修改 div 的背景颜色
- sublimetext3 - Sublime Text 中的 flake8 linter 停止显示 F841 已分配但从未使用过警告
- javascript - 添加后如何更改书签的名称?
- python-3.x - Vader 情绪分析:如何对单个单词进行评分?
- node.js - nodejs 已经是最新版本,但是 node -v 显示错误
- java - 使用 Java 解析 XML(JAXB 和根元素)
- c# - 在 C# 中构成枚举的两个部分的名称是什么?