html - 将图像和链接视为一个元素
问题描述
我正在制作一个响应式网站。在底部,我有一个电话图标、一个电话号码、一个邮件图标和一个邮件地址——所有这些都在一行中。
<img src="https://cdn.pixabay.com/photo/2013/07/13/10/30/icon-157358_960_720.png" height="150px" width="111px">
<a href="tel:123456">123456</a>
<img src="https://cdn.pixabay.com/photo/2016/06/13/17/30/mail-1454734_960_720.png" height="150px" width="150px">
<a href="mailto:asdf@gmail.com">asdf@gmail.com</a>
在全窗口中,它看起来像这样:
[phone img][phone number] [mail img][mail address]
当我调整窗口大小时,它们最终会变成这样:
[phone img][phone number][mail img]
[mail address]
我希望图标和文本粘在一起,像这样:
[phone img][phone number]
[mail img][mail address]
我尝试用 div 和 span 将它们封装起来,但没有一个奏效。我还用谷歌搜索了“html 两个元素粘在一起”,但没有结果。
感觉真的很基础,我觉得很愚蠢,但我想不通。
解决方案
这个怎么样:
<a href="tel:123456">
<img src="phone.jpg">123456
</a>
<a href="mailto:asdf@gmail.com">
<img src="mail.jpg">asdf@gmail.com</a>
使用 css 添加填充和响应行为
推荐阅读
- algorithm - 以下排序算法对哪种输入数据好/坏?
- git - Git 命令查找特定类型的上一个分支
- javascript - 这是来自 Pro React 16 book kosher 的 Redux reducer 示例吗?
- apache-spark - 如何保证debezium生成的topic事件顺序,存储在kafka中,发送到spark?
- typescript - 如何在 TypeScript 中加载文件
- excel - VBA 代码在一台计算机上运行,但在另一台计算机上出现语法错误
- r - r 行间距
- firebase - Firebase CLI:“功能:警告!在 PACKAGE.JSON 中找不到引擎字段。默认为节点 6 运行时。”
- python - 声明类属性时如何触发setter?
- java - 计算形状的面积