簡體   English   中英

如何在HTML正文標簽上添加到背景圖片的鏈接

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

在此頁面上,我在<body>標記上具有背景圖像,並且我想知道是否可以向其添加鏈接,以便單擊該鏈接。

如果這不可能,我將如何添加將被超鏈接的包裝器<div>

<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";
})

在這里擺弄

嘗試這個

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM