可点击的jumbotron背景图象

时间:2016-02-26 07:17:58

标签: html angularjs node.js twitter-bootstrap

我正在使用jumbotron背景图片,我希望图片可以点击。当我点击图像时,它应该重定向到另一个页面。我怎么能这样做?

<div class="jumbotron">

</div>

.jumbotron{
background:url(../images/jumb.jpg) no-repeat center center; 
    -webkit-background-size: 100% 100%;
    -moz-background-size: 100% 100%;
    -o-background-size: 100% 100%;
    background-size: 100% 100%;
    height:400px;
}

2 个答案:

答案 0 :(得分:0)

试试这个,

&#13;
&#13;
.jumbotron{
background:url('../images/jumb.jpg') no-repeat center center; 
    -webkit-background-size: 100% 100%;
    -moz-background-size: 100% 100%;
    -o-background-size: 100% 100%;
    background-size: 100% 100%;
    height:400px;
}
&#13;
<a href="http://google.com"><div  class="jumbotron">
</div></a>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

你可以简单地将你的jumbotron包裹在一个锚标记中,并给出该锚标记的href属性的明确路径。其余的代码是完美的。像这样

<a href="http://www.google.com" target="_blank">
  <div class="jumbotron">

  </div>
</a>

可选属性target="_blank"在新标签页中打开链接,而不是相同。如果不需要,请将其删除。

注意:http://协议在此非常重要,否则会重定向到当前项目目录中的www.google.com之前的网址。