| 网管联盟 | 网管论坛 | 网管u家 | 网管博客 | 网管软件 | 网管求职 | 小游戏 | 网管搜索 | 网管原创 | 网管聚合 | 网管读摘 | 网管焦点 | 世界素材 | 会员投稿 | 会员中心 |
![]() |
| Windows Linux Cisco 网络技术 数据库 黑客攻防 DotNet Java PHP 认证 新闻资讯 服务器 存储资讯 网络设备 网管学堂 技术专题 焦点 网吧频道 |
代码:
<!DOCTYPE <a href="http://www.qqread.com/keywords/html.html" target="_blank">html</a> PUBLIC "-//W3C//DTD <a href="http://www.qqread.com/keywords/xhtml.html" target="_blank">XHTML</a> 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS实例讲解:地图提示(map pop)档</title>
<style type="text/css" media="all">
* {
margin:0;
padding:0;
}
img {
border:0;
} 网管u家u.bitsCN.com
#show{
text-align:left;
}
网管论坛bbs_bitsCN_com
ul {
list-style-type:none;
background: transparent url(/articleimg/2007/03/4514/map_flat.jpg) no-repeat 0 0;
width:350px;
height:250px;
border:1px solid #000;
}
网管u家u.bitscn@com
ul li {
display:inline;
}
ul li a {
position:relative;
display:block;
text-decoration:none;
}
ul li a span.offset {
position:absolute;
margin-top:-9000px;
margin-left:-9000px;
}
中国网管论坛bbs.bitsCN.com
ul li a:hover span.offset, ul li a:focus span.offset, ul li a:active span.offset {
color: #000;
background-image:none;
background-color:#ffffde;
border:1px solid #000;
display:block;
width:150px;
height:auto;
text-decoration:none;
cursor:pointer;
}
ul li a:hover span.offset span, ul li a:focus span.offset span, ul li a:active span.offset span {
display:block;
width:140px;
margin:5px;
height:120px;
} 网管网www.bitscn.com
ul li a#map01 {
width:80px;
height:60px;
margin-top:0;
margin-left:130px;
}
网管网www_bitscn_com
ul li a#map01:hover, ul li a#map01:focus, ul#cmp li a#map01:active {
background:transparent url(/articleimg/2007/03/4514/map_flat_on.jpg) no-repeat -130px 0px;
} 中国网管联盟bitsCN.com
ul li a#map01:hover span.offset, ul li a#map01:focus span.offset, ul li a#map01:active span.offset {
margin-top:-1px;
margin-left:230px;
} 网管网www.bitscn.com
ul li a#map02 {
width:110px;
height:75px;
margin-top:-50px;
margin-left:235px;
}
ul li a#map02:hover, ul li a#map02:focus, ul li a#map02:active {
background:transparent url(/articleimg/2007/03/4514/map_flat_on.jpg) no-repeat -235px -10px;
}
网管u家u.bitsCN.com
ul li a#map02:hover span.offset, ul li a#map02:focus span.offset, ul li a#map02:active span.offset {
margin-top:-11px;
margin-left:125px;
}
ul li a#map03 {
width:75px;
height:95px;
margin-top:3px;
margin-left:115px;
} 网管联盟bitsCN_com
ul li a#map03:hover, ul li a#map03:focus, ul li a#map03:active {
background:transparent url(/articleimg/2007/03/4514/map_flat_on.jpg) no-repeat -115px -88px;
}
网管下载dl.bitscn.com
ul li a#map03:hover span.offset, ul li a#map03:focus span.offset,ul li a#map03:active span.offset {
margin-top:-89px;
margin-left:245px;
}
ul li a#map04 {
width:110px;
height:120px;
margin-top:-60px;
margin-left:5px;
} 网管论坛bbs_bitsCN_com
ul li a#map04:hover, ul li a#map04:focus, ul li a#map04:active {
background:transparent url(/articleimg/2007/03/4514/map_flat_on.jpg) no-repeat -5px -123px;
}
ul li a#map04:hover span.offset, ul li a#map04:focus span.offset, ul li a#map04:active span.offset {
margin-top:-124px;
margin-left:355px;
}
网管论坛bbs_bitsCN_com
ul li a#map05 {
width:95px;
height:97px;
margin-top:-90px;
margin-left:240px;
}
中国网管论坛bbs.bitsCN.com
ul li a#map05:hover, ul li a#map05:focus, ul li a#map05:active {
background:transparent url(/articleimg/2007/03/4514/map_flat_on.jpg) no-repeat -240px -153px;
}
网管u家u.bitscn@com
ul li a#map05:hover span.offset, ul li a#map05:focus span.offset, ul li a#map05:active span.offset {
margin-top:-154px;
margin-left:120px;
}
</style>
</head>
<body>
<ul>
<li><a id="map01" href="#map01"><span class="offset"><img src="/articleimg/2007/03/4514/map1.jpg" alt="Post Office" /><span>This is the Popsville community <strong>Post Office</strong>, your home of over-priced postage. Click map for more</span></span></a></li>
<li><a id="map02" href="#map02"><span class="offset"><img src="/articleimg/2007/03/4514/map2.jpg" alt="Dew Drop Inn" /><span>Home is where the beer is. And that means the <strong>Dew Drop Inn</strong>. Live music on the weekends. Click map for more</span></span></a></li>
<li><a id="map03" href="#map03"><span class="offset"><img src="/articleimg/2007/03/4514/map3.jpg" alt="River Beach" /><span>Spend lazy summer afternoons at the beautiful <strong>River Beach</strong>. Hang out on the nude beach. Click map for more</span></span></a></li> 网管联盟bitsCN@com
<li><a id="map04" href="#map04"><span class="offset"><img src="/articleimg/2007/03/4514/map4.jpg" alt="Woodland Traders" /><span>Our local <strong>Woodland Traders</strong> is a veritable Mecca of consumer goods and hardware. Click map for more</span></span></a></li>
<li><a id="map05" href="#map05"><span class="offset"><img src="/articleimg/2007/03/4514/map5.jpg" alt="Wild Game Diner" /><span>Country living means road kill, and the <strong>Wild Game Diner</strong> prepares it with special sauce. Click map for more</span></span></a></li>
</ul>
</body>
</html>
网管bitscn_com
这个实例,基本上是应用hover来实现隐藏/显示效果。 中国网管联盟bitsCN.com
实例初始部分内容被隐藏,当hover时让其隐藏的内容显示。对于初始的隐藏我们可以通过,对父元素设置相对位置(position : relative;),对其要隐藏的子元素设置绝对位置(position : absolute;),然后对要隐藏的子元素设置margin属性,并给于无限大负值让其移动无限远隐藏,而当hover触发时,通过对隐藏的子元素重新设置margin值让其显示。对于图片中变化的部分我们可以通过hover时背景图的变化来实现。 网管论坛bbs_bitsCN_com
网管下载dl.bitscn.com
|
0
|
评论加载中…