html - 如何处理滑动门和非事件按钮

标签 html css

我有这样的解决方案:http://jsfiddle.net/snowman/sns2J/

正如您在示例中看到的,我必须包括以下内容:

.paging .inactive a:hover
{
    background-position:    100% -26px;
    border-width:            0px;
    cursor:                 default;
}
.paging .inactive a:hover span
{
    background-position:    0 -26px;
    color:                    #d9d9d9;
    cursor:                 default;
}

禁用悬停效果。

有没有更好的办法?

最佳答案

使用attribute selectors区分 anchor <a>其中有 href属性和那些不:

.paging a
{
    background: transparent url('http://imgur.com/bExgs.png') no-repeat scroll top right;
    color: #444;
    display: block;
    float: left;
    font: normal 12px arial, sans-serif;
    height: 26px;
    margin-right: 6px;
    padding-right: 13px; /* sliding doors padding */
    text-decoration: none;
}
.paging a span
{
    background: transparent url('http://i.stack.imgur.com/C4JSY.png') no-repeat;
    display: block;
    line-height: 14px;
    padding: 6px 0 6px 13px;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
.paging a span {float:none;}
/* End IE5-Mac hack */
.paging a[href]:hover span{
    color:            black;
}
.paging .current a
{
    background-position:    100% -52px;
    border-width:            0px;
}
.paging .current a span
{
    background-position:    0 -52px;
    color:                    black;
}
.paging .inactive a
{
    background-position:    100% -26px;
    border-width:            0px;
}
.paging
{
    list-style:     none;
    margin:         0px;
    padding:        0px;
    color:          #444444;
    font:           12px arial,sans-serif;
}

.paging li
{
    margin-left:    0px;
    float:          left;
}

.paging .inactive a span
{
    background-position:    0 -26px;
    color:                    #d9d9d9;
}

.paging .inactive a[href]:hover
{
    background-position:    100% -26px;
    border-width:            0px;
    cursor:                 default;
}
/*
.paging .inactive a:hover span
{
    background-position:    0 -26px;
    color:                    #d9d9d9;
    cursor:                 default;
}
*/
.paging a[href]:hover
{
    background-position:        100% -52px;
    color:                    black;
}
.paging a[href]:hover span{
      background-position:        0 -52px;
}

关于html - 如何处理滑动门和非事件按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5288634/

相关文章:

javascript - 移动设备上的Java单击事件

HTML href 链接不可点击

html - 以横向模式从 HTML 打印 SVG

javascript - 重置样式继承在 shadow dom 中不起作用

java - 是否有基于 AJAX 网络的 Junit TestRunner?

html - 如何在下一行对齐两个相同高度的div和第三个div

html - 我想将模板背景颜色更改为印度国旗三色

javascript - 用于更改 css bg 颜色的 jQuery 函数

css - 仅在没有 id 的情况下在 django 中显示某些照片库

html - Bootstrap 3 - 将 4 个 div 按 25% 放置,并在下方再放置一个 div