You need to enable JavaScript to run this app. GitHub README开发:如何不使用CSS将两个HTML元素并排对齐?
优惠活动
大模型
产品
解决方案
定价
更多

GitHub README开发:如何不使用CSS将两个HTML元素并排对齐?

实现并排对齐的两种无CSS方案

方案1:合并p标签

img为内联替换元素,同一父容器内的图片默认横向排列,直接将两张图片放到同一个居中p标签内即可:

<details>
    <summary>Minhas Estátisticas no Github</summary>
    <p align="center">
        <img src="https://github-readme-stats.vercel.app/api?locale=pt-br&username=carlos3g&theme=radical&show_icons=true&include_all_commits=true" alt="Estátisticas Gerais" />
        <img src="https://github-readme-stats.vercel.app/api/top-langs?locale=pt-br&username=carlos3g&theme=radical" alt="Techs utilizadas nos projetos" />
    </p>
</details>

方案2:Table布局

如果担心窄宽度下图片自动换行,可使用GFM原生支持的HTML table布局,通过单元格排列实现稳定并排,无需任何CSS:

<details>
    <summary>Minhas Estátisticas no Github</summary>
    <table align="center">
        <tr>
            <td>
                <img src="https://github-readme-stats.vercel.app/api?locale=pt-br&username=carlos3g&theme=radical&show_icons=true&include_all_commits=true" alt="Estátisticas Gerais" />
            </td>
            <td>
                <img src="https://github-readme-stats.vercel.app/api/top-langs?locale=pt-br&username=carlos3g&theme=radical" alt="Techs utilizadas nos projetos" />
            </td>
        </tr>
    </table>
</details>

内容的提问来源于stack exchange,提问作者Carlos Mesquita

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.11.10 17:06:03