链接到背景图像
Linking to background images
我希望放在主背景上的每个小图像都link可用。问题是它们在代码中也被称为背景(不知道如何以其他方式做到这一点)。有没有办法让它们中的每一个都可以点击,里面有不同的 link ?提前致谢。
body,
html {
height: 100%;
margin: 0;
}
body {
background-image: url("https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png"),
url("https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png"),
url("https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png"),
url("https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/yI9FRzo/vertical-pan-of-red-lentils-on-white-background-2-this-video-was-shoot-using-custom-light-set-up-with-additional-custom-build-underneath-light-system-to-eliminate-shadows_nkcfxbgmx__F0000.png");
height: 15%, 10%, 20%, 20%;
background-position: 397px 30%, 540px 17%, 683px 30%, 0px 0px;
background-repeat: no-repeat;
background-size: 5%, 5%, 5%,cover;
}
在您的 HTML 中创建 <div></div>
,每个 div 都有自己的 background-image,然后根据需要组织它们。
您可以将小图片添加为元素,方法是将它们添加到 body 标签中作为
<body>
<div id="smallimg1" class="smallimg">
<a href="yourlinkhere" target="_blank">
<img src="linktoimghere.jpg" alt="" />
</a>
</div>
</body>
如果您真的希望它们是背景图像而不是 img,请将它们添加为 div 的背景并通过 css 添加背景图像以及高度和宽度。
一定要cssurl吗?
另一种解决方案是在 html 中创建它,然后设置其他样式
An image as a link: <a href="https://link.com">
<img border="0" alt="img" src="logo.jpg" width="100" height="100">
</a>
我希望放在主背景上的每个小图像都link可用。问题是它们在代码中也被称为背景(不知道如何以其他方式做到这一点)。有没有办法让它们中的每一个都可以点击,里面有不同的 link ?提前致谢。
body,
html {
height: 100%;
margin: 0;
}
body {
background-image: url("https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png"),
url("https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png"),
url("https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png"),
url("https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/yI9FRzo/vertical-pan-of-red-lentils-on-white-background-2-this-video-was-shoot-using-custom-light-set-up-with-additional-custom-build-underneath-light-system-to-eliminate-shadows_nkcfxbgmx__F0000.png");
height: 15%, 10%, 20%, 20%;
background-position: 397px 30%, 540px 17%, 683px 30%, 0px 0px;
background-repeat: no-repeat;
background-size: 5%, 5%, 5%,cover;
}
在您的 HTML 中创建 <div></div>
,每个 div 都有自己的 background-image,然后根据需要组织它们。
您可以将小图片添加为元素,方法是将它们添加到 body 标签中作为
<body>
<div id="smallimg1" class="smallimg">
<a href="yourlinkhere" target="_blank">
<img src="linktoimghere.jpg" alt="" />
</a>
</div>
</body>
如果您真的希望它们是背景图像而不是 img,请将它们添加为 div 的背景并通过 css 添加背景图像以及高度和宽度。
一定要cssurl吗?
另一种解决方案是在 html 中创建它,然后设置其他样式
An image as a link: <a href="https://link.com">
<img border="0" alt="img" src="logo.jpg" width="100" height="100">
</a>