【问题标题】:Custom CSS for MVC PagedListMVC PagedList 的自定义 CSS
【发布时间】:2016-10-14 11:53:17
【问题描述】:

我在我的网站上使用了 PagedList.MVC,但我在使用 CSS 时遇到了一些问题,因为我的网站上的分页看起来:

但应该看起来:

我也在使用 bootstrap 和我自己的 css .. 所以它们之间一定有冲突。我找不到冲突开始的地方。 对自定义 css 有任何想法吗?也许在这里添加一些样式:

.pagination {
  display: compact;
  padding-left: 0;
  margin: 0;
  border-radius: 4px;
}

.pagination > li {
  display: inline-grid;
}

.pagination > li > a,
.pagination > li > span {
  position: relative;
  float: left;
  padding: 0;
  margin-left: -1px;
  line-height: 1.428571429;
  text-decoration: none;
  background-color: #eee;
  border: 1px solid #dddddd;
}

.pagination > li:first-child > a,
.pagination > li:first-child > span {
  margin-left: 0;
  border-bottom-left-radius: 4px;
  border-top-left-radius: 4px;
}

.pagination > li:last-child > a,
.pagination > li:last-child > span {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.pagination > li > a:hover,
.pagination > li > span:hover,
.pagination > li > a:focus,
.pagination > li > span:focus {
  background-color: #eeeeee;
}

.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
  z-index: 2;
  color: #000;
  cursor: default;
  background-color: #428bca;
  border-color: #428bca;
}

.pagination > .disabled > span,
.pagination > .disabled > a,
.pagination > .disabled > a:hover,
.pagination > .disabled > a:focus {
  color: #999999;
  cursor: not-allowed;
  background-color: #eee;
  border-color: #dddddd;
}

.pagination-lg > li > a,
.pagination-lg > li > span {
  padding: 0;
  font-size: 18px;
}

.pagination-lg > li:first-child > a,
.pagination-lg > li:first-child > span {
  border-bottom-left-radius: 6px;
  border-top-left-radius: 6px;
}

.pagination-lg > li:last-child > a,
.pagination-lg > li:last-child > span {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.pagination-sm > li > a,
.pagination-sm > li > span {
  padding: 0;
  font-size: 12px;
}

.pagination-sm > li:first-child > a,
.pagination-sm > li:first-child > span {
  border-bottom-left-radius: 3px;
  border-top-left-radius: 3px;
}

.pagination-sm > li:last-child > a,
.pagination-sm > li:last-child > span {
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
}

【问题讨论】:

  • 这里可以加html代码吗?
  • 在 Chrome 的开发者工具中,您可以突出显示一个元素,然后查看计算的样式。选择一个属性,它会告诉你它来自哪里 - 从那里解决冲突应该相当容易。
  • 我没有发现与 Chrome 的开发者有任何冲突

标签: css asp.net-mvc pagedlist


【解决方案1】:

使用这个 css

ul
{
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden; /*background-color: #333;*/
}
li
{
    float: left;
    border-right: 1px solid #bbb;
}
li:last-child
{
    border-right: none;
}
li a
{
    display: block;
    color: Black;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}
li a:hover:not(.active)
{
    background-color: #4CAF50;
}
.active
{
    background-color: #4CAF50;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-01
    • 2018-10-24
    • 1970-01-01
    • 1970-01-01
    • 2020-10-19
    • 1970-01-01
    • 2015-08-14
    相关资源
    最近更新 更多