html - 在 <a> 标签内为 <img> 标签添加下划线

标签 html css html-email

我有一个 <a>里面有文字和图片的标签。我希望图像和文本带有下划线,如下所示:

enter image description here

不过我一直得到的是:

enter image description here

如您所见,下划线没有延伸到箭头下方。这是我的代码:

  <a target="_blank" href="http://url.com" style="text-decoration:underline;color:#000001;" >Call To Action <img src="image/path/triangle.png" border="0" /></a>

现在我不能在包装容器上放置边框底部,因为在移动设备上我需要为文本加下划线,这只会在文本底部放置边框。

最佳答案

您需要使用 border-bottom 设置 a 的样式并移除 text-decoration:underline

<a target="_blank" href="http://url.com" style="border-bottom:1px solid red;text-decoration:none;color:#000001;">Call To Action <img src="//lorempixel.com/20/20" border="0" /></a>

关于html - 在 <a> 标签内为 <img> 标签添加下划线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35637701/

相关文章:

javascript - 更改 :hover on iPad So First Touch is Registered as onclick and :hover Functionailty Still Works

c# - 电子邮件 : how to set a name of the embedded image in C#/System. 邮件?

php - 将表单电子邮件发送至 .cc 电子邮件

css - 在 Hotmail HTML 电子邮件中使用 <div> 作为垂直分隔符的问题

html - 如何使用动态内容的 CSS 流体间距保持对称

javascript - 切换输入标题未正确显示

html - 在显示 :table div? 内水平滚动 div

css - 将鼠标悬停在带有兄弟选择器的文本上

css - z-index 麻烦,高级 z-indexing

html - 如何在标题中垂直居中文本?