-4

我的 JS Fiddle 在这里:http: //jsfiddle.net/n6f5x/

我有以下CSS:

/* Advanced CSS hover styles */
ul.hosplead { overflow: hidden; padding: 5px; }
ul.hosplead > li {
    position: relative;
    float: left;
    list-style: none;
    margin: 0 20px 20px 0;
    font-size: 10px;
    z-index: 1;

}
ul.hosplead li                          { text-decoration: none; display: block; }
ul.hosplead li img                      { display: block; position: relative; z-index: -1; } /* IE8 fix, background colour appears behind img for uknown reason set negative z-index */
ul.hosplead li:not([class=na]) img      { position: static; } /* Reset relative position, as this plays havoc with good browsers */
ul.hosplead li:hover, ul li:focus           { display: block; outline: none; -moz-box-shadow: 3px 3px 5px #000; -webkit-box-shadow: 3px 3px 5px #000; box-shadow: 3px 3px 5px #000; }
ul.hosplead li:hover img, ul li:focus img   { outline: 3px solid #ccc; }

ul.hosplead li:hover:after,
ul.hosplead li:focus:after
{
    content: attr(title);
    color: #000;
    position: absolute;
    bottom: 0;
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    width: 100%;
    background: rgb(255,255,255);
    background: rgba(255,255,255,0.7);
    background: -moz-linear-gradient(top, rgba(255,255,255,0.7), rgba(204,204,204,0.7)); /* Firefox 3.6+ */
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.7)), to(rgba(204,204,204,0.7))); /* Safari */
    display: block;
    text-shadow: 1px 1px 1px #fff;
}

以及以下 HTML:

                    <ul class=hosplead>
                        <li title="Pradeep Chandra [CMO]">
                            <img src="http://4.bp.blogspot.com/_ShYMN0KZ8w4/TUzaT1Z5izI/AAAAAAAAEj4/KRiNd1ossSE/high-quality-wallpapers%5B6%5D.jpg" width="205" title="Pradeep Chandra [CMO]" height="295" alt="Pradeep Chandra [CMO]" />
                        </li>
                    </ul>

我要做的是翻转效果,换句话说,当用户访问页面时,ON HOVER 效果应该是默认的。我怎样才能做到这一点?

4

3 回答 3

3

不知道为什么需要有人为您编写 CSS,但确实如此。:-) 正如其他人所暗示的那样,这只是稍微扭转事情的问题。

http://jsfiddle.net/isherwood/n6f5x/6/

ul.hosplead li { /* was :hover */
    /* no changes */
}
ul.hosplead li:hover {
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}
ul.hosplead li img { /* was :hover */
    /* no changes */
}
ul.hosplead li:hover img {
    outline: none;
}
ul.hosplead li:after { /* was :hover */
    /* no changes */
}
ul.hosplead li:hover:after {
    display: none;
}
于 2013-05-01T18:55:12.377 回答
1

删除hoverCSS DEMO http://jsfiddle.net/n6f5x/2/中的选择器

li {
    // no hover selector stated
}
于 2013-05-01T18:48:59.473 回答
1

CSS 版本:删除:hover您的样式:http: //jsfiddle.net/kuroisuna/n6f5x/1/

使用 jQuery,您可以使用一个类来模拟:http: //jsfiddle.net/kuroisuna/n6f5x/5/hover.active

...删除mouseenter.

于 2013-05-01T18:53:09.283 回答