引导程序上的模式屏幕未显示完整图像大小。
我尝试更改CSS中的模式大小,但无济于事。
<div class="modal fade bd-example-modal-lg show" id="ftl1Modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="dynamic-content">
<img src="~/Content/Images/FamilyTrees/FamilyTreeLarge_1.png" class="img-fluid" alt="Family Tree Image 1" />
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4 col-6">
<a href="#ftl1Modal" role="button" class="d-block mb-4 h-100" data-toggle="modal">
<img src="~/Content/Images/FamilyTrees/FamilyTreeThumb_1.png" class="img-fluid" alt="Family Tree Image 1" />
</a>
</div>
我希望当我单击缩略图时,它将以其真实的宽度和高度显示图像,有没有办法实现这一目标?
一如既往地感谢您的帮助。
答案 0 :(得分:1)
您可以像这样使模态适合图像的宽度...
d-flex
添加display:flex
flex-shrink-1 w-auto mx-auto
添加flex-shrink:1;width:auto
然后使用自定义类重置最大宽度:
.modal-custom {
max-width: inherit;
}
https://www.codeply.com/p/BuCU19i1mH/
<div class="modal fade show" id="ftl1Modal" role="dialog">
<div class="modal-dialog d-flex modal-custom">
<div class="modal-content flex-shrink-1 w-auto mx-auto">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="dynamic-content">
<img src="..." class="img-fluid" alt="Family Tree Image 1" />
</div>
</div>
</div>
</div>