如何在README.md中为div标签添加背景颜色

问题描述 投票:0回答:3

我尝试了这段代码,但它不起作用

| <div bgcolor='red'>[<img  src='https://cdn.jsdelivr.net/npm/[email protected]/icons/github.svg' alt='github' height='20'>](https://github.com/HuKKu-ec)</div> |<div > ABc </div>|
| -------- | ----------- |

我试图为我的 github 徽标提供一些白色背景,因为徽标颜色是黑色,这在黑暗的 github bio 中不好看。

github readme readme.io
3个回答
0
投票

为了在我的自述文件中解决这个问题,我必须为每个 svg 添加一个单独的版本,并带有一个白色矩形以强制使用白色背景。

<rect 
  width="80"
  height="80"
  fill="white" />

不理想,但这是我针对同一问题找到的唯一可行的解决方案。

比较示例:

https://github.com/samuelneff/customized-vectors/blob/main/beach-bbq.svg

https://github.com/samuelneff/customized-vectors/blob/main/beach-bbq-bgwhite.svg


-1
投票

您可以将此类添加到您的 div 中。

<div class="background: white;">

-1
投票

将其放在 div 标签上:

style="background: white;"
© www.soinside.com 2019 - 2024. All rights reserved.