css图片映射
a <div class="imagemap">
<img src="img/map.png" width="496px" height="382px" alt="A BAND"/>
<ul>
<li class="rim"><a href="" title="Rim">Rim</a></li>
<li class="jim"><a href="" title="Jim">Jim</a></li>
<li class="sim"><a href="" title="Sim">Sim</a></li>
<li class="nim"><a href="" title="Nim 弄啥来">Nim</a></li>
</ul> </div>
以上是html的代码部分,将图片至于div容器中。热点用无序列表嵌套<a>标签的形式。
.imagemap{
margin-top:2em;
width:496px;
height:382px;
position:relative;/*KEY*/
}
.imagemap ul{
margin:0;
padding:0;
list-style:none;}
.imagemap a{
position:absolute;//绝对定位于容器左上角 负值缩进文本使之隐藏
display:block;
width:60px;
height:65px;
text-indent:-1000em;}
/*定位热点的位置*/
.imagemap .rim a{
top:20px;
left:75px}
.imagemap .jim a{
top:20px;
left:215px}
.imagemap .sim a{
top:25px;
left:375px}
.imagemap .nim a{
top:65px;
left:285px}
/*实现反转效果*/
.imagemap a:hover,
.imagemap a:focus{
border:1px solid #fff;
}
容器的宽高要与图片一致,注意设置相对定位。
对热点根据头像大小设置宽高,应用绝对定位,文本用较大的负值缩进进行隐藏。
针对每一个头像位置,设置热点位置。(效果如下)

flicker样式的翻转
两者的区别在于,在原来的基础上多了外框和解释标签,为此在原来的<a>标签插入三个span标签,两个是外框,一个是解释标签。
<div class="imagemap">
<img src="img/map.png" width="496px" height="382px" alt="A BAND"/>
<ul>
<li class="rim"><a href="" title="Rim"><span class="outer"><span class="inner"><span class="note">Rim</span></span></span></a></li>
<li class="jim"><a href="" title="Jim"><span class="outer"><span class="inner"><span class="note">Jim</span></span></span></a></li>
<li class="sim"><a href="" title="Sim"><span class="outer"><span class="inner"><span class="note">Sim</span></span></span></a></li>
<li class="nim"><a href="" title="Nim 弄啥来"><span class="outer"><span class="inner"><span class="note">Nim</span></span></span></a></li>
</ul> </div>
.imagemap{
margin-top:2em;
width:496px;
height:382px;
position:relative;/*KEY*/
}
.imagemap ul{
margin:0;
padding:0;
list-style:none;}
.imagemap a{
position:absolute;/*绝对定位于容器左上角 负值缩进文本使之消失 */
display:block;
color:#000;
border:1px solid transparent;
}
imagemap a .outer{
display:block;
border:1px solid transparent;
}
.imagemap a .inner{
display:block;
width:60px;
height:65px;
border:1px solid transparent;}
.imagemap .rim a{
top:20px;
left:75px}
.imagemap .jim a{
top:20px;
left:215px}
.imagemap .sim a{
top:25px;
left:375px}
.imagemap .nim a{
top:65px;
left:285px}
.imagemap a:hover,
.imagemap a:focus{
border-color:#d4d82d;
}
.imagemap a .note{
position:absolute;
bottom:-2em;
width:3em;
padding:0.2em 0.5em;
background-color:#ffc;
text-align:center;
left:-1000em;//在正常状态隐藏解释标签
margin-left:-2em;//使得标签居于热点中央。
}
.imagemap a:hover .outer,
.imagemap a:focus .outer{
border-color:#000;}
.imagemap a:hover .inner,
.imagemap a:focus .inner{
border-color:#fff;}
.imagemap a:hover .note,
.imagemap a:focus .note{
left:30px;}
css图片映射的更多相关文章
- HTML CSS简介与图片映射
1. CSS 入门 内联样式:在 HTML 元素中使用 “style” 属性,需要将表现与内容混在一起: 内部样式表:在 HTML 文档头部 <head> 区域使用 <style&g ...
- 大众点评评论数据抓取 反爬虫措施有css文字映射和字体库反爬虫
大众点评评论数据抓取 反爬虫措施有css文字映射和字体库反爬虫 大众点评的反爬虫手段有那些: 封ip,封账号,字体库反爬虫,css文字映射,图形滑动验证码 这个图片是滑动验证码,访问频率高的话,会出 ...
- 几种垂直居中的方式及CSS图片替换技术
由于块级元素的高度是可以设置的,所以对于块级元素的垂直居中比较简单. 方法一: 在不定高的情况下,把元素的上下内边距设为同一个值即可实现,即padding :10px 0; 以上方法针对块级元素和 ...
- css图片叠加和底部定位
css图片叠加和底部定位 css图片叠加 两张图片需要叠在一起显示,如何定位 容器先对定位 第一张图片正常摆放 第二张图片绝对定位,top:0px 这样便实现了两张图片叠加在一起了,设置z-index ...
- 转:利用node压缩、合并js,css,图片
1.安装nodejs http://nodejs.org/ 2.安装各自的node package js我用的是UglifyJS github地址:https://github.com/mishoo/ ...
- CSS图片列表
1.效果图: 2.Example Source Code <h3><a href="http://www.52css.com/">我爱CSS画廊</a ...
- 漂亮的自适应宽度的多色彩CSS图片按钮
一.素材 二.效果 三.CSS *{padding:0;margin:0} /*----------------------------------- 自适应宽度图片按钮 ...
- css图片垂直居中
css图片垂直居中一.style代码 .case-pic{ height: 125px; position: relative; text-align: center } .case-pic span ...
- css 图片 圆形显示区域
css 图片 圆形显示区域 css 和 div 实现 方形图片 圆形显示 点击下载
随机推荐
- 开发WebForm时遇到的问题
在做一个小项目时,一个很长的页面,页面底部有一个contact us form 整个页面我没有使用MVC,而是使用ASP.NET WebForm(.aspx)来实现,实现功能后发现,当用户在页面底部输 ...
- HDU1025:Constructing Roads In JGShining's Kingdom(LIS)
Problem Description JGShining's kingdom consists of 2n(n is no more than 500,000) small cities which ...
- jeecms支持的freemaker标签大全
<@e.form id="jvForm" action="o_add.do"> <@e.text label="字段名" ...
- Lua学习笔记(六):协程
多线程和协程 多线程是抢占式多任务(preemptive multitasking),每个子线程由操作系统来决定何时执行,由于执行时间不可预知所以多线程需要使用同步技术来避免某些问题.在单核计算机中, ...
- win8 或 win2008 系统 TFS 打开或获取源代码非常慢
最近刚更新了win8.1 .打开VS2012后,准备签出个文件,突然发现速度非常慢.打开个TFS目录都要过10多秒才能看到所有子内容.一开始以为是VS的问题更新了U4补丁.结果还是一样.后来googl ...
- VS2012开发ActiveX插件 尝试1
今天闲来无聊研究了下 ActiveX插件开发,以前一直以为很牛逼,然后发现还是比较简单的东西.. 首先: 在开始前 准备好 VS12开发工具,cabarc.exe 工具(注:这是 用来 将文件打包成c ...
- C++访问权限
1.C++类本身没有访问权限的概念,就是class Base. 2.类成员的访问权限有:public.protected.private 3.类的继承方式有:public.protected.priv ...
- Don't Repeat Yourself (不要重复你自己)
DRY是指Don't Repeat Yourself特指在程序设计以及计算中避免重复代码,因为这样会降低灵活性.简洁性,并且可能导致代码之间的矛盾.<The Pragmatic Programm ...
- decide your linux OS is GUI or not
Try: ps -ef|grep X The ps command will display information about a selection of the active process ...
- 简化版可用于多线程的logger
logger 嘛要高效,要简单.废话不多话. GitHub 地址 https://github.com/goldli/logger 本文所说的logger使用System.Logger做为NameSp ...