大家好,我的问题如下。如何使 H1 标签具有响应性,以便它不会在我的图像上移动框。我的项目使用的是 bootstrap 4.5.2。
这是我的 html 代码
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
officeMap
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">officeMap</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="dynamic-content">
<img src="PlanPage/Resources/grid.png" alt="officeMap" class="img-fluid">
<div class="room1"><h1>1</h1></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
这是我的 css
body {
background-image: url('Resources/blurred_desk1.jpg');
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.room1 {
position: absolute;
bottom: 10%;
left: 12%;
}
我使用的图片 https://hbr.org/resources/images/article_assets/2013/04/grid.png
答案 0 :(得分:1)
答案 1 :(得分:1)
我像这样试过,它奏效了。
@media screen and (min-width: 1200px){
.room1 {
position: absolute;
bottom: 10%;
left: 12%;
}
}
@media screen and (max-width: 1199px) and (min-width: 990px) {
.room1 {
position: absolute;
bottom: 10%;
left: 18%;
}
}
@media screen and (max-width: 989px) {
.room1 {
position: absolute;
bottom: 10%;
left: 30%;
}
}