我有带图像的模态窗口,一切正常,但对于某些图像,我在图像的右侧有空白区域。
示例:http://www.bootply.com/yjIFNRdcF1
<a data-toggle="modal" data-target="#full-flyer-120" href="#">CLICK ME</a>
<div class="modal fade" id="full-flyer-120" tabindex="-1" role="dialog" aria-labelledby="full-flyer-120Label" style="display: none;">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<img class="img-responsive" src="http://portalwiedzy.onet.pl/_i/mendelejew.jpg" alt="Full mendelejew">
</div>
</div>
</div>
</div>
如何更改它以使模态窗口与图像大小相同?
答案 0 :(得分:1)
只需将以下内容添加到样式表即可。
.carousel-inner>.item>a>img, .carousel-inner>.item>img, .img-responsive, .thumbnail a>img, .thumbnail>img {
display: block;
width: 100%;
height: auto;
}
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<a data-toggle="modal" data-target="#full-flyer-120" href="#">CLICK ME</a>
<div class="modal fade" id="full-flyer-120" tabindex="-1" role="dialog" aria-labelledby="full-flyer-120Label" style="display: none;">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<img class="img-responsive" src="http://portalwiedzy.onet.pl/_i/mendelejew.jpg" alt="Full mendelejew">
</div>
</div>
</div>
</div>
基本上,您需要稍微改变图像样式。
希望这有帮助