简体   繁体   中英

Color in HTML table not taken into account

I use an HTML table on this URL: https://www.pascaldegut.com/pages/prestation-webdesign , with red crosses and green checks.

It works great on desktop, but using my iPhone (Safari), the crosses and checks are black

在此处输入图片说明

Here is a sample of the code I use

<table class="blueTable" border="1" cellpadding="0" cellspacing="0" rules="all" frames="border" style="width: 100%;">
<thead>
<tr>
<th style="width: 40%;">Services</th>
<th style="width: 20%;">Basique</th>
<th style="width: 20%;">PREMIUM</th>
<th style="width: 20%;">GOLD</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text">Audit & CR Vidéo</td>
<td class="check" style="color: #006600">✔</td>
<td class="check" style="color: #006600">✔</td>
<td class="check" style="color: #006600">✔</td>
</tr>
<tr>
<td class="text">Design Page Accueil</td>
<td class="check" style="color: #006600">✔</td>
<td class="check" style="color: #006600">✔</td>
<td class="check" style="color: #006600">✔</td>
</tr>
</tbody>
</table>

Moreover, I tried to force CSS with this code, without success

  td.cross {
    color: FF0000 !important;
  }

  td.check {
    color: 006600 !important;
  }

Any idea here? It's tricky for me to resolve it since I can't replicate the issue from my editor on desktop

Thank you in advance :) Pascal

It's to do with the use of the unicode characters and . I was able to inspect element on my iPhone and it seems to be caused by the iPhone Safari pre-defining the style and colour for those characters used. By simply changing them to a font, eg Font Awesome , you will be able to achieve what you want.

Resources: Cross - Tick

The following are screenshots of my testing: 检查元素:使用<code> x </ code>而不是以前使用的

屏幕快照检查元素的结果。

I think Safari does not find colors that take this formula : #006600

Change it to the following format : style="color: rgb(0,102,0)"

 <table class="blueTable" border="1" cellpadding="0" cellspacing="0" rules="all" frames="border" style="width: 100%;"> <thead> <tr> <th style="width: 40%;">Services</th> <th style="width: 20%;">Basique</th> <th style="width: 20%;">PREMIUM</th> <th style="width: 20%;">GOLD</th> </tr> </thead> <tbody> <tr> <td class="text">Audit & CR Vidéo</td> <td class="check" style="color: rgb(0,102,0)">✔</td> <td class="check" style="color: rgb(0,102,0)">✔</td> <td class="check" style="color: rgb(0,102,0)">✔</td> </tr> <tr> <td class="text">Design Page Accueil</td> <td class="check" style="color: rgb(0,102,0)">✔</td> <td class="check" style="color: rgb(0,102,0)">✔</td> <td class="check" style="color: rgb(0,102,0)">✔</td> </tr> </tbody> </table> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM