所以,我需要标题的两小部分可以点击。问题是我无法使用 map 标签,因为我的图像在 css 中设置为 div 的背景。而且我不允许更改它(改为使用 img src )。我怎样才能做到这一点,而不使用图像后面两个 div 的绝对定位。
CSS:
#bg_top { /*the design for the header*/
background:url(../images/header_bg_new.png) center top no-repeat;
min-height: 100%; /*stick footer to bottom of the page*/
text-align:left;
width:100%;
最佳答案
他们是解决这个问题的一个技巧......
在div#bg_top中添加一个尺寸为1x1的透明gif图像,然后在img标签中分配其宽度和高度...
<div id="bg_top"><img src="spacer.gif" width="100%" height="100%" /></div>
然后在其中添加 map 标签... 这是一个简单的技巧,您可以使用...
您也可以通过 jquery 应用 img 标签,
$("#bg_top").html("<img src='spacer.gif' width='100%' height='100%' />");
从此链接下载图像:- Spacer.gif
关于html - 类似于css中的map标签吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11499963/