Readers: 35 | Updated: 2007

CSS Image Maps, Redux

Translate Into:
I have received a number of emails after publishing my first take/experiment on CSS Image Maps. Feedback was both well received, as well as criticized. As you can imagine -- based on the "image sprite" method used for the first take -- much of the feedback centered around the use of this sprite, so to speak. While the CSS Image Map was useful in theory, creating stacked copies of the same image in Photoshop (or you graphic tool of choice) didn't seem like the ideal way of solving the issue.

So.... I went back to the drawing board, and came up with another solution that requires a single image, some CSS, and a little creativity! This second example makes use of transparent images (PNG images) to indicate an annotation on an image. Much of the same CSS from the first example was used, with a few minor alterations. Below is a sample of the old vs. the new:

CSS (Original):

dd#monitorDef{ top: 65px; left: 114px; }
dd#monitorDef a{ position: absolute; width: 73px; height: 69px; text-decoration: none; }
dd#monitorDef a span{ display: none; }
dd#monitorDef a:hover{ position: absolute; background: transparent url(office.jpg) -109px -317px no-repeat; top: -10px; left: -5px; }

dd#monitorDef a:hover span{
 display: block;
 text-indent: 0;
 vertical-align: top;
 color: #000;
 background-color: #F4F4F4;
 font-weight: bold;
 position: absolute;
 border: 1px solid #BCBCBC;
 bottom: 100%;
 margin: 0;
 padding: 5px;
 width: 250%;
}

CSS (Revised):

dd#oceanDef{ top: 165px; left: 63px; }
dd#oceanDef a{ position: absolute; width: 205px; height: 70px; text-decoration: none; border: 1px solid #FFFCE6;   background: transparent url(note.png) repeat; }
dd#oceanDef a span{ display: none; }
dd#oceanDef a:hover{ background: transparent url(hover.png) repeat; border: 1px solid #BCBCBC; }
dd#oceanDef a:hover span{
 display: block;
 text-indent: 0;
 vertical-align: top;
 color: #000;
 background-color: #F4F4F4;
 font-weight: bold;
 position: absolute;
 border: 1px solid #BCBCBC;
 bottom: 100%;
 margin: 0;
 padding: 5px;
 width: 75%;
 }

HTML:

<dl id="lalaLandMap">
  <dt class="title">Manhattan Beach, California</dt>
  <dt id="homes">1. Beautiful Homes</dt>
  <dd id="homesDef"><a href="#"><span>How I would love an ocean-front property -- in LA!</span></a></dd>
  <dt id="baywatch">2. Baywatch!</dt>
  <dd id="baywatchDef"><a href="#"><span>Is that Hasselhoff?</span></a></dd>
  <dt id="ocean">3. Ocean</dt>
  <dd id="oceanDef"><a href="#"><span>This is the life...</span></a></dd>
</dl>


From The Blogs

Internet Observation

2007
CSS按钮的图片替换
根据Mike Rundle 与Seamus P. H. Leahy的css图片替换的扩展技术和WebDesign-L mailing list中发布的一个帖子,我发掘了一个提交按钮和按钮标签的图片替换... 查看全文

Internet Observation

2007
CSS的水平与垂直中心
预览:http://www.456bereastreet.com/lab/centered/both/代码:  html, body {  margin:0;  padding:0;  font-fa... 查看全文

Vdot Media

04-11
Vertically center content with CSS
A convenient benefit of using tables is the ability to vertically center content within a cell using the valign attribute. Unfortunately, acheiving the same effect with CSS isnt so convenient. So, as ... 查看全文

Noupe

04-11
37+ Great Ajax, CSS Tab-Based Interfaces
Over the last few years web-developers have developed many AJAX and CSS Tab-based interfaces which became one of the most interesting techniques giving us an easy way to get information without the ne... 查看全文

Noupe

04-11
7 Advanced CSS Menu, A Great Roundup!!
New techniques are being developed and updated all the time for creating unique menu techniques. We keep an eye on the recent developments and collect new ideas and methods for our readers and after a... 查看全文

Internet Observation

2007
CSS缩放
预览: http://www.deltatangobravo.com/images/zoom/代码:text-small.cssbody, div { font-size:    x-small; v... 查看全文

Internet Observation

2007
CSS制表符
代码:    body { margin:0; padding:0; font: bold 11px/1.5em Verdana;}h2 { font: bold 14px Verdana, Aria... 查看全文

Internet Observation

2007
用CSS显示百分比
在Amigo,我们看到了百分比条(percentage bar)!该图片就是Jason创作的: 为了将这部分的设计变得更灵动一点,我发现了两个选项; “聪明的”CSS或是“多图像”(Lots of I... 查看全文

Internet Observation

2007
是否在新窗口中打开链接由用户决定
很多网虫都期望off-site链接(链接到其他站点)可以在一个新的窗口中打开。很多时候,桌面上会开着很多窗口,所以网虫开始使用更棒的浏览器。这些浏览器会有更多的选项,让用户掌握主控权。与此同时,W3C... 查看全文

Internet Observation

2007
CSS图像弹出
我在www.stunicholls.myby.co.uk站点上发现了这个效果,我在我的一个房地产网站上也使用过这样的功能。该功能即为弹出图像,和你曾经看到过的使用JavaScript制作出的mouse... 查看全文
More Articles