html - 为移动设备调整页脚大小
问题描述
我已经制作了一个页脚,但我不知道如何使三个图像更小并垂直对齐以供移动设备使用。我想要所有 3 个大约 50% 的大小并在一条垂直线上。
HTML 是 -
<div class="as-seen-footer">
<div class="as-seen-items" style="display: flex;">
<div class="as-featured">
<h1 style="color: white; font-weight: lighter;">as featured in</h1>
</div>
<div class="verticalLine" style="padding-right: 20px;"></div>
<div class="as-seen-images" style="display: flex;">
<img class="alignnone size-full wp-image-5021" src="https://ffe-dev.flowersforeveryone.co.za/wp-content/uploads/2019/08/news_24_logo.svg" alt="Media 24" />
<img class="alignnone size-full wp-image-5022" style="width: 150px; padding-right: 20px;" src="https://ffe-dev.flowersforeveryone.co.za/wp-content/uploads/2019/08/home_magazine_logo.svg" alt="Home Magazine" />
<img class="alignnone size-full wp-image-5023" style="width: 100px; padding-right: 20px;" src="https://ffe-dev.flowersforeveryone.co.za/wp-content/uploads/2019/08/tuis_tydskrif_logo.svg" alt="" />
</div>
</div>
</div>
桌面的 CSS 是 -
.as-featured h1 {
font-size: 22px;
}
.as-featured {
padding-top: 12px;
padding-right: 20px;
}
img.alignnone.size-full.wp-image-5021
{
width: 150px;
padding-right: 20px;
}
.as-seen-items {
display:flex;
text-align: center;
}
.as-seen-images {
display:flex;
}
.as-seen-footer {
background: #000000;
margin-top: 20px;
text-transform: uppercase;
display: flex;
justify-content: center;
height: 130px;
}
.verticalLine {
border-left: solid #fff;
border-width: 2px;
height: 80px;
margin-top: 10px;
margin-bottom: 10px;
margin-left: 20px;
margin-right: 20px;
}
我尝试了以下媒体查询,它调整了文本和垂直线的大小,但我无法让图像移动和调整大小 -
@media all and (max-width: 768px)
{
.as-featured h1 {
font-size: 16px;
white-space: nowrap;
}
.as-featured {
padding-top: 15px;
}
img.alignnone.size-full.wp-image-5021 {
width: 60%;
display: inline;
}
.as-seen-footer {
background: #000000;
margin-top: 10px;
text-transform: uppercase;
height: 100px;
}
.verticalLine {
border-left: solid #fff;
border-width: 2px;
height: 70px;
margin-top: 15px;
margin-bottom: 15px;
margin-left: -5px;
margin-right: -5px;
}
}
解决方案
避免使用px
指定元素的宽度和高度,因为它没有响应性。使用vw
and vh
which 分别代表viewport
宽度和viewport
高度。vw
并 指定相对于正在查看网站的设备大小的大小如果使用和指定大小,vh
则无需使用。@media
vw
vh
推荐阅读
- listview - Flutter/Firestore - 在流构建器中的动态列表视图上实现“分页”
- excel - 如何创建超链接数组(Excel VBA)?
- reporting-services - Ssrs,使用通配符计算一个文件
- c - 为什么'x'的值打印在main中,而它可能在从abc()出来时被释放?
- php - 使用多个 where 子句选择多个查询
- android-studio - 无法生成 APK - 出现错误:无法解决:com.github.2359media:Easy AndroidAnimations:0.8
- coq - QuickChick 上下文转发
- loopbackjs - 如何在控制器中获取应用程序实例?
- python - 在 python 中使用 Rasterio 读取光栅文件时出现内存错误
- javascript - 我需要有关名为“ReferenceError:消息未定义”的错误的帮助。