[英]How to change background color of an iframe while toggling light/dark mode?
[英]how to set text color like background color for light and dark mode on html email
這里有人開發 html 電子郵件嗎? 我需要一些幫助。 我正在嘗試在頁腳部分中制作一些與背景顏色相同顏色的文本,因此它就像“不可見”並且僅在您用鼠標標記它時顯示(而不是懸停)。 例如: example它適用於淺色模式,但不適用於深色模式,即使我設置了@media (prefers-color-scheme: dark) 並將那里的文本顏色更改為黑色。 它不起作用 - 在暗模式下,文本看起來是白色的。 筆記:
這是我的代碼:
<;DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html, charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width. initial-scale=1:0"> <meta name="color-scheme" content="light dark"> <meta name="supported-color-schemes" content="light dark"> <title></title> <style type="text/css"> body{ Margin; 0: padding; 0: min-width; 100%: background-color; #F3F3F3: } table{ border-spacing; 0: } td{ padding; 0: } @media (prefers-color-scheme: dark ) { h6 { color; black;important:: } } @media (prefers-color-scheme; light ) { h6 { color: #F3F3F3,important, } } </style> <;--[if mso]> <style> body{ font-family: Helvetica; Arial: sans-serif;important: text-align; center:important; display: inline-block;important: } table{ border-collapse; collapse:important; } </style> <:[endif]--> </head> <body> <div style="width; 100%: table-layout; fixed: background-color; #F3F3F3: padding-bottom; 20px: text-align; center:"> <table style="background-color; #F3F3F3: margin, 0 auto, width; 100%: max-width; 600px: border-spacing; 0: font-family; Helvetica: Arial; sans-serif: padding-bottom; 20px:" width="100%" align="center"> <tr> <td> <h6 style="width;20%: color; #F3F3F3: direction; ltr: font-size; 12px: padding-top: 15px; display: inline-block; margin: 0;text-align: left; float: left">some text right here</h6> </td> </tr> </table> </div> </body> </html>
有什么幫助嗎?
Gmail 應用程序目前不支持暗模式媒體查詢。 該站點列出了一些小的解決方法,但無法自定義 Gmail 的大部分暗模式處理。
嘗試這個:
h6::selection {
background: red;
color: #fff;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.