[英]Reverse background color for each cell in html table
I have an html table of unicode numbers in varying colors and I'd like to do 2 things.我有一个包含不同颜色的 unicode 数字的 html 表,我想做两件事。
Here is a sample row.这是一个示例行。
<table>
<tr>
<td align="center;"><mark class="unicode" style="color: #ffbf00; font-size: 15em; font-weight: bold;">①</mark></td>
<td align="center;"><mark class="unicode" style="color: #b5c306; font-size: 15em; font-weight: bold;">②</mark></td>
<td align="center;"><mark class="unicode" style="color: #b87333; font-size: 15em; font-weight: bold;">③</mark></td>
<td align="center;"><mark class="unicode" style="color: #1560bd; font-size: 15em; font-weight: bold;">④</mark></td>
<td align="center;"><mark class="unicode" style="color: #614051; font-size: 15em; font-weight: bold;">⑤</mark></td>
</tr>
</table>
You can apply a different coloration to the background and the same color for the unicode to have the needed result when using mix-blend-mode
.在使用
mix-blend-mode
时,您可以对背景应用不同的颜色并对 unicode 应用相同的颜色以获得所需的结果。 To have the same size, consider monospace
as font-family
.要具有相同的大小,请将
monospace
视为font-family
。
You can also adjsut padding
/ line-height
to control the spaces:您还可以调整
padding
/ line-height
来控制空格:
table, th, td { border: 1px solid black; } td { padding:0 1.5em 1.5em; } mark { font-size: 20em; font-weight: bold; mix-blend-mode: exclusion; color: #fff; background: transparent; font-family: monospace; line-height:0.6; }
<table style="width: 10%;" border="0"> <tbody> <tr> <td style="background-color: #ffbf00"><mark class="unicode">①</mark></td> <td style="background-color: #b5c306"><mark class="unicode">②</mark></td> <td style="background-color: #b87333;"><mark class="unicode">③</mark></td> <td style="background-color: #1560bd;"><mark class="unicode">④</mark></td> <td style="background-color: #614051"><mark class="unicode">⑤</mark></td> </tr> </tbody> </table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.