{"id":49,"date":"2021-09-26T00:22:39","date_gmt":"2021-09-26T00:22:39","guid":{"rendered":"https:\/\/webaffair.net\/blog\/?p=49"},"modified":"2025-08-27T02:20:34","modified_gmt":"2025-08-27T02:20:34","slug":"my-favourite-text-gradients","status":"publish","type":"post","link":"https:\/\/webaffair.net\/blog\/code\/snippets\/my-favourite-text-gradients\/","title":{"rendered":"My Favourite Text Gradients"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Note: I am using -webkit prefixed styles for all three relevant rules to ensure that only browsers that implement all three will load the background gradient at all. I could use a proper polyfill and\/or @supports, but honestly this creates more readable code. Non-webkit browsers have started using webkit prefixes too, so <em>this<\/em> code works on basically everything except Opera Mini if people let their browsers auto-update.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note2: Most of the gradient disappears on thin line text on most of these (though sometimes a very subtle effect is what you might be going for.) Either bold or a heavy display font like copperplate works well. Gradient text does, however, tend to be easily visible on both light and dark backgrounds &#8211; if you choose the right colors. (Though check the contrast with a visual tool for colorblindness accessibility &#8211; automated accessibility checkers only check against the fallback color.)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note3: Gradient text sometimes can&#8217;t be seen on highlight, particularly if you&#8217;ve set a custom highlight color, because the highlight is rendered in front of the background, which is where the gradient comes from. The fix for that is <code>::selection { -webkit-text-fill-color: currentColor; }<\/code><\/p>\n\n\n\n<b style=\"font-size: 1.2rem;margin-right:2em;display:inline-block;color:crimson;background:-webkit-linear-gradient(crimson,goldenrod);-webkit-background-clip:text;-webkit-text-fill-color:transparent;\">Fire<\/b>\n<b style=\"font-size: 1.2rem;margin-right:2em;display:inline-block;color:crimson;background:-webkit-linear-gradient(crimson,darkred);-webkit-background-clip:text;-webkit-text-fill-color:transparent;\">Blood<\/b>\n<b style=\"font-size: 1.2rem;margin-right:2em;display:inline-block;color:saddlebrown;background:-webkit-linear-gradient(goldenrod,sienna);-webkit-background-clip:text;-webkit-text-fill-color:transparent;\">Tawnyfur<\/b>\n<b style=\"font-size: 1.2rem;margin-right:2em;display:inline-block;color:slategray;background:-webkit-linear-gradient(darkgray,darkslateblue);-webkit-background-clip:text;-webkit-text-fill-color:transparent;\">Gunmetal<\/b>\n<b style=\"font-size: 1.2rem;margin-right:2em;display:inline-block;color:darkgoldenrod;background:-webkit-linear-gradient(silver,darkgoldenrod,goldenrod);-webkit-background-clip:text;-webkit-text-fill-color:transparent;\">Gold<\/b>\n<b style=\"font-size: 1.2rem;margin-right:2em;display:inline-block;color:darkgreen;background:-webkit-linear-gradient(yellowgreen,darkgreen,green);-webkit-background-clip:text;-webkit-text-fill-color:transparent;\">Forest<\/b>\n\n\n\n<pre class=\"wp-block-code css\"><code>b.fire {\n    color: crimson;\n    background: -webkit-linear-gradient(crimson, goldenrod);\n    -webkit-background-clip: text;\n    -webkit-text-fill-color: transparent;\n}\n\nb.blood {\n    color: crimson;\n    background: -webkit-linear-gradient(crimson, darkred);\n    -webkit-background-clip: text;\n    -webkit-text-fill-color: transparent;\n}\n\nb.tawnyfur {\n    color: saddlebrown;\n    background: -webkit-linear-gradient(goldenrod, sienna);\n    -webkit-background-clip: text;\n    -webkit-text-fill-color: transparent;\n}\n\nb.gunmetal {\n    color: slategray;\n    background: -webkit-linear-gradient( gray, darkslateblue);\n    -webkit-background-clip: text;\n    -webkit-text-fill-color: transparent;\n}\n\nb.gold {\n    color: darkgoldenrod;\n    background: -webkit-linear-gradient(silver, darkgoldenrod, goldenrod);\n    -webkit-background-clip: text;\n    -webkit-text-fill-color: transparent;\n}\n\nb.forest {\n    color:darkgreen;\n    background:-webkit-linear-gradient(yellowgreen,darkgreen,green);\n    -webkit-background-clip:text;\n    -webkit-text-fill-color:transparent;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: I am using -webkit prefixed styles for all three relevant rules to ensure that only browsers that implement all three will load the background gradient at all. I could use a proper polyfill and\/or @supports, but honestly this creates more readable code. Non-webkit browsers have started using webkit prefixes too, so this code works&#8230; <a class=\"read-more\" href=\"https:\/\/webaffair.net\/blog\/code\/snippets\/my-favourite-text-gradients\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[27],"tags":[18],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-snippets","tag-css"],"jetpack-related-posts":[{"id":317,"url":"https:\/\/webaffair.net\/blog\/code\/basics\/introduction-to-browser-development-tools\/","url_meta":{"origin":49,"position":0},"title":"Introduction to Browser Development Tools","author":"Jay","date":"December 18, 2025","format":false,"excerpt":"All modern desktop browsers now have integrated browser tools, however, there are subtle (and sometimes less subtle) differences between each. I find that Firefox has the best overall, though I do switch to Chrome for some specific debugging tasks. I personally only use Edge or Safari when trying to isolate\u2026","rel":"","context":"In &quot;Basics&quot;","block_context":{"text":"Basics","link":"https:\/\/webaffair.net\/blog\/category\/code\/basics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/12\/DevToolsSettingsFirefox-1-scaled.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/12\/DevToolsSettingsFirefox-1-scaled.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/12\/DevToolsSettingsFirefox-1-scaled.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/12\/DevToolsSettingsFirefox-1-scaled.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/12\/DevToolsSettingsFirefox-1-scaled.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/12\/DevToolsSettingsFirefox-1-scaled.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":9,"url":"https:\/\/webaffair.net\/blog\/code\/basics\/funky-cursor-colours\/","url_meta":{"origin":49,"position":1},"title":"Changing the Colors of Input Elements","author":"Jay","date":"September 16, 2021","format":false,"excerpt":"Ever been on a forum site with a really nice dark theme, but then you go to make a post, and are presented with a large blindingly white text area to type in? Maybe with tiny, hard to read font? Of course you have. But this is a 100% fixable\u2026","rel":"","context":"In &quot;Basics&quot;","block_context":{"text":"Basics","link":"https:\/\/webaffair.net\/blog\/category\/code\/basics\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":115,"url":"https:\/\/webaffair.net\/blog\/code\/basics\/using-svg-filters-in-css\/","url_meta":{"origin":49,"position":2},"title":"Using SVG Filters in CSS","author":"Jay","date":"June 2, 2024","format":false,"excerpt":"Firstly, you'll need the svg itself. <svg style=\"height:0; overflow:hidden;\"> <defs> <filter id=\"wavy2\"> <feTurbulence x=\"0\" y=\"0\" baseFrequency=\"0.02\" numOctaves=\"5\" seed=\"1\"><\/feTurbulence> <feDisplacementMap in=\"SourceGraphic\" scale=\"20\"><\/feDisplacementMap> <\/filter> <filter id=\"goo\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"8\" result=\"blur\"><\/feGaussianBlur> <feColorMatrix in=\"blur\" mode=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19 -9\"\u2026","rel":"","context":"In &quot;Basics&quot;","block_context":{"text":"Basics","link":"https:\/\/webaffair.net\/blog\/category\/code\/basics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2024\/06\/filter2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2024\/06\/filter2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2024\/06\/filter2.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":250,"url":"https:\/\/webaffair.net\/blog\/code\/basics\/responsive-font-sizes-title-bars\/","url_meta":{"origin":49,"position":3},"title":"Responsive Font Sizes &amp; Title Bars","author":"Jay","date":"November 20, 2025","format":false,"excerpt":"Let's say we want a reall big, chunky main title for our forum skin. Here's, I think, the simplest way to do it, I see this a lot: .maintitle { height: 160px; line-height: 160px; text-align: center; font-size: 40px; } If we add that to the stylesheet and check it on\u2026","rel":"","context":"In &quot;Basics&quot;","block_context":{"text":"Basics","link":"https:\/\/webaffair.net\/blog\/category\/code\/basics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/11\/responsive-font-sizes-step10-desktop.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/11\/responsive-font-sizes-step10-desktop.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/11\/responsive-font-sizes-step10-desktop.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/11\/responsive-font-sizes-step10-desktop.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/webaffair.net\/blog\/wp-content\/uploads\/2025\/11\/responsive-font-sizes-step10-desktop.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":340,"url":"https:\/\/webaffair.net\/blog\/code\/javascript-free-inline-hide-spoiler-tags\/","url_meta":{"origin":49,"position":4},"title":"Javascript-Free Inline Hide Spoiler Tags","author":"Jay","date":"August 13, 2026","format":false,"excerpt":"The basic related html is: <details class=\"spoiler\">This text is hidden<\/details> Giving you this: This text is hidden This will also work with this html: <details class=\"spoiler\"><summary>Spoiler<\/summary>This text is hidden<\/details> Giving you this: SpoilerThis text is hidden How I did it: Step 1: Make the details tag flow inline with the\u2026","rel":"","context":"In &quot;Basics&quot;","block_context":{"text":"Basics","link":"https:\/\/webaffair.net\/blog\/category\/code\/basics\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":137,"url":"https:\/\/webaffair.net\/blog\/code\/basics\/ajax-and-images\/","url_meta":{"origin":49,"position":5},"title":"AJAX and Images","author":"Jay","date":"June 22, 2024","format":false,"excerpt":"Okay so I recently figured this out, fixed it on my scripts, forgot about it, was just reminded, realized I ought to document\/share. So this is getting posted here and a couple other places. When you do a fetch() or $.get() the browser only fetches that specific page, and doesn't\u2026","rel":"","context":"In &quot;Basics&quot;","block_context":{"text":"Basics","link":"https:\/\/webaffair.net\/blog\/category\/code\/basics\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/comments?post=49"}],"version-history":[{"count":7,"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":133,"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/posts\/49\/revisions\/133"}],"wp:attachment":[{"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/media?parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/categories?post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webaffair.net\/blog\/wp-json\/wp\/v2\/tags?post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}