我尝试使用bootstrap中的modal,但是我想使用图像而不是按钮。但我根本没有看到如何做到这一点。在哪里插入
data-toggle="modal" data-target="#myModal
http://getbootstrap.com/javascript/#modals
引导模式
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
答案 0 :(得分:12)
您可以将图片放在像这样的链接中......
<a data-toggle="modal" data-target="#myModal">
<img src="//placehold.it/100x30">
</a>
答案 1 :(得分:0)
您可以保留按钮HTML并将背景图像添加到CSS。请参阅此Stackoverflow question中的示例。