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
相关产品推荐
相关产品推荐

