【问题标题】:How to place image over image without position absolute如何在没有绝对位置的情况下将图像放置在图像上
【发布时间】:2015-11-24 04:05:43
【问题描述】:

我想创建一个HTML 电子邮件模板,电子邮件提供商不允许使用某些css 样式属性,例如Gmail、Outlook,这样的属性之一就是position:absolute。我想将图像放在图像上,使用div's 和position:absolute 我可以像this 那样做。我们如何在不使用position:absolute 的情况下使用tables 实现this。我在互联网上搜索过,但没有找到任何提供解决方案的相关文章。

以下是 JSFiddle 链接:使用 Div 的:Link, 有表:Link。

编辑:至少有没有可能我想知道?

【问题讨论】:

  • 电子邮件提供商也会忽略负边距。
  • 使用你最喜欢的图像编辑器并合并这两个。
  • 我需要动态实现,意味着图像将以编程方式动态呈现。所以,我做不到。
  • 如果不允许边距...您是否尝试过使用负左位置?
  • 我没试过,我现在试试。

标签: css position css-position absolute


【解决方案1】:

你可以使用负边距和垂直对齐:

<div style="position: relative; left: 0; top: 0;">
<img src="http://s17.postimg.org/ypnmpvdu7/cute_cartoons_21.jpg" style="" width="300px" height="300px" />
<img src="http://s17.postimg.org/bmx3qpccr/contest_badge_rank_1.png" style="margin-left:-150px;position:relative;vertical-align:60px; "/>
        </div>

https://jsfiddle.net/vhkssL0q/10/

【讨论】:

    猜你喜欢
    • 2010-12-22
    • 1970-01-01
    • 1970-01-01
    • 2021-06-13
    • 1970-01-01
    • 1970-01-01
    • 2020-12-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多