我如何将 link 添加到 html body 标签上的背景图片

how do i add a link to a background image on html body tag

在这个 page 上,我在 <body> 标签上有一个背景图片,我想知道是否可以向其中添加一个 link,以便点击进入某些内容。

如果这不可能,我将如何添加一个包装器 <div> 以进行 hyperlinked?

<body id="index">
</body>

body#index {
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-image: url(//) !important;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: transparent !important;
  background-position: center;
  width: 100%;
  height: 100%;

检查这是否是您想要的

 <body id="index">

    </body>

CSS

body#index {

    background-color: red !important;

    width:100vw;

    height: 100vh;

}

Jquery

$('body').click(function () {
    location.href="http://www.google.com";
})

fiddled here

试试这个