【问题标题】:Aligning img elements horizontally and vertically in the middle of a floating div在浮动 div 的中间水平和垂直对齐 img 元素
【发布时间】:2011-04-06 17:55:51
【问题描述】:

我正在寻找一种解决方案,在固定大小为 96x96 的 div 中间垂直和水平对齐一些图像。

How to make an image center (vertically & horizontally) inside a bigger div 有解决方案。但它假设我们知道图像的大小。但就我而言,尺寸各不相同。

另外,我只想使用 CSS。我不想使用像 this 这样的 jquery 插件。

任何帮助将不胜感激。谢谢。

编辑:我通过使用图像作为背景并将背景位置设置为“中心中心”找到了解决方案。

【问题讨论】:

    标签: css


    【解决方案1】:

    Need to center align the image in CSS

    通过 css 添加与内容相关的图像也被认为是不好的做法。一旦用户关闭 CSS,您的内容就消失了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-28
      • 2013-11-25
      • 2017-07-01
      • 2011-04-26
      • 1970-01-01
      • 2014-09-18
      • 2014-11-10
      • 1970-01-01
      相关资源
      最近更新 更多