image - 顶部标题 Img 留在计算机上 & 中心在手机和平​​板电脑上

标签 image css responsive

今天我在我正在编辑的一些软件的顶部添加了一个带有动画 gif 的彩色背景表格。使用适当的 css,我怎样才能让图像始终留在计算机屏幕上,并在手机和平​​板电脑上居中?下面是我如何拥有当前的 HTML。谢谢! :--)

<table style="width: 100%;">
  <tbody>
    <tr>
      <td style="background-color: #663399;">
        <div><img src="Image URL" alt="Animated Gif"></div>
      </td>
    </tr>
  </tbody>
</table>

最佳答案

.img-wraper {
   text-align: left; 
}
.img-wraper img {
  display: inline-block; 
}

@media (max-width: 1024px) {
  .img-wraper {
    text-align: center;
  }
}
<table style="width: 100%;">
  <tbody>
    <tr>
      <td style="background-color: #663399;">
        <div class="img-wraper"><img src="Image URL" alt="Animated Gif"></div>
      </td>
    </tr>
  </tbody>
</table>

关于image - 顶部标题 Img 留在计算机上 & 中心在手机和平​​板电脑上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53311970/

相关文章:

image - 在 Unity 3D 中更改按钮图像

css - div 布局(浮在其他元素上)

javascript - 如何通过ajax动态加载历史页面

jquery - CSS/HTML 加载栏

html - 媒体查询,哪种方法更好,为什么?

html - 不同的字体大小取决于字符数(响应式)

python - 重构文本中的鹈鹕外部图像

javascript 图像交换影响太多图像

html - css 背景颜色在响应中连续所有 div 的大小相同

css - 一次上传一个大文件,然后使用 css 更改其比例,或者使用不同大小的同一图像的不同文件?