我的 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 效果应该是默认的。我怎样才能做到这一点?