简体   繁体   English

引导程序使图像的一部分可点击

[英]Bootstrap make part of the image clickable

Fairly new to this. 对此还算陌生。 At the moment I have an image and a button in one of the containers in my front page. 目前,我的首页中的一个容器中有一个图像和一个按钮。 I'm trying to embed that button into that image. 我正在尝试将该按钮嵌入到该图像中。 Should I 我是不是该

  1. make part of that image clickable, and let that trigger a function? 使该图像的一部分可点击,并让其触发功能?
  2. or force that button to float on certain position of that picture? 还是迫使该按钮浮在图片的特定位置上?

Or is there another way that I should follow? 还是我应该遵循另一种方式? and how do I implement this? 以及如何实现呢? Many thanks! 非常感谢!

<div class="col-md-10 col-lg-offset-1 text-center"> 
        <img src="../img/background.png" class="rounded" alt="">
        <button  type="button" id="s"  class="btn" >Make payment</button> //I'm trying to have this button float on that image above
</div>

You can use position: absolute to make it float on the image. 您可以使用position: absolute使它浮动在图像上。 look at this 看这个

https://jsfiddle.net/5ueau24b/1/ https://jsfiddle.net/5ueau24b/1/

 #s { position: absolute; margin-left: -200px; margin-top: 130px; } 
 <div class="col-md-10 col-lg-offset-1 text-center"> <img src="http://www.planwallpaper.com/static/images/images_1_05GM1zY.jpg" class="rounded" alt=""> <button type="button" id="s" class="btn" >Make payment</button> //I'm trying to have this button float on that image above </div> 

Try using imagemap of html. 尝试使用html的imagemap。 (map tag in specific) (特定于地图标签)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM