html - 类似于css中的map标签吗?

标签 html css image

所以,我需要标题的两小部分可以点击。问题是我无法使用 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/

相关文章:

javascript - 按下按钮时如何隐藏/显示内容?

html - 表格单元格的滚动条

Selenium 的CSS查询

javascript - 在 Microsoft 平板电脑/触摸屏显示器上使用 mozilla firefox 禁用默认捏合缩放

html - 元素周围的括号样式边框

html - 悬停图片效果

javascript - 悬停推送内容

jquery - 我如何使用 jquery 和 css 实现这样的半 slider ?

php - 在网络服务器上存储多种尺寸的图像或调整当前图像的大小

javascript - 不存在 'Access-Control-Allow-Origin' header