javascript - 我的引导轮播背景图像不随浏览器窗口大小调整
问题描述
好的,所以我是编程新手,我一直在着手一个项目,我正在为个人网站开发前端。我决定在我的 index.html 中使用引导轮播背景图像滑块,但是当我调整浏览器屏幕时,页面大小会缩小,并且轮播文本也会缩小和重叠。
我的代码是这样的
.container {
margin-top: 20px;
}
.navbar{
background-color : #3e403e;
}
.text h1{
font-size: 110px
}
.text p{
font-size: 40px
}
hr{
background-color: white
}
.text a{
padding: 15px 80px 15px 80px;
}
.header-text {
position: absolute;
top: 20%;
left: 1.8%;
right: auto;
width: 96.66666666666666%;
}
<div id="indexCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="images/background.png" alt="Slide One">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="images/background 2.png" alt="Slide Two">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="images/background 3.png" alt="Slide Three">
</div>
<div class="header-text hidden-xs">
<div class="col-md-12 text center">
<div class="container">
<div class="text">
<h1 class="display-4" style="color:white"><strong>Beats, Sounds Vibes!!!</strong></h1>
<p class="lead" style=" color:white">What are you waiting for?</p>
<hr class="my-4">
<p style="color: white">XQ's music is made from the purest selection of industry-level sounds
and
samples. Vibe with him, and you"ll see what we're talking about.</p>
<a class="btn btn-primary btn-lg" href="beats.html" role="button">Dive in</a>
</div>
</div>
</div>
</div>
</div>
</div>
我会很感激帮助。
解决方案
在 css 中使用 @media screen 和 (max-width: 600px) {} 用于小屏幕
@media screen and (max-width: 600px) {
.text h1{
font-size: 40px
}
}
推荐阅读
- java - 从电话簿中的我的应用程序中多次显示一些联系人
- php - 联系表格 7 POST URL 未找到 - 404
- c# - DataGrid Grouping - 获取每个组的行
- docker - 无法从作业连接到 gitlab-ci 服务(有时)
- python - 使用 ctypes 将 C 数组从 C 函数返回到 Python
- angular - 无法在 Ionic App 中将产品尺寸添加到购物车
- typescript - 使用 Observable next - Typescript 语法
- angular - Angular + Springboot:如何让 Routed Angular 应用程序从服务器端回退到 index.html?
- c++ - 华氏到摄氏度的错误结果
- javascript - 是否可以让我的 Angular 前端在 Django 后端订阅我的 Redis 服务器?