html - 调整移动页脚的大小

标签 html css

我制作了一个页脚,但我不知道如何缩小这三张图片并使其在移动设备上垂直对齐。我想要所有 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指定元素的宽度和高度,因为它没有响应。使用 vwvh代表viewport宽度和 viewport高度分别代替。 vwvh指定相对于正在查看网站的设备大小的大小无需使用 @media如果使用 vwvh指定尺寸。

关于html - 调整移动页脚的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57622758/

相关文章:

html - CSS/HTML 内联显示表格,直到它们超过父 div 的宽度?

php - 如何在 foreach 循环中选择一个特定选项

jquery - 即使在网站刷新后如何检查跨度是否有值(value)

Javascript Canvas 绘图 - 大量运动时像素化

javascript - HTML5 视频在源更新之前无法播放

javascript - SEO - 显示 block anchor 标记包含标题和短描述与仅带有 js 的标题

css - 使用 font-face 时的随机字母间距

css - Nuxt & Vuetify : how to control the order in which CSS files are loaded?

html - 不同的页面模板在 WordPress 中不显示内容

html - 按钮背景颜色未显示在边缘,但适用于 Firefox 和 Chrome