{"id":2866,"date":"2012-10-19T15:56:47","date_gmt":"2012-10-19T22:56:47","guid":{"rendered":"https:\/\/bryanhadaway.com\/?p=2866"},"modified":"2025-05-22T15:20:49","modified_gmt":"2025-05-22T22:20:49","slug":"how-to-create-gradients-in-css","status":"publish","type":"post","link":"https:\/\/webguy.io\/blog\/how-to-create-gradients-in-css\/","title":{"rendered":"How to Create Gradients in CSS"},"content":{"rendered":"<style>.grad{font-size:16px;color:#fff !important;text-decoration:none !important;padding:15px;background:linear-gradient(#40b3ff, #09f)}<\/style>\n<p>Finally, the standard is here for creating non-browser-specific CSS gradients across all the latest, standards-compliant browsers!<\/p>\n<h2>CSS<\/h2>\n<pre><code>.grad{background:linear-gradient(#40b3ff, #09f)}<\/code><\/pre>\n<h2>HTML<\/h2>\n<pre><code>&lt;a href=&quot;#&quot; class=&quot;grad&quot;&gt;Simple Gradient Hurray!&lt;\/a&gt;<\/code><\/pre>\n<h2>Demo<\/h2>\n<p><a href=\"#\" class=\"grad\">Simple Gradient Hurray!<\/a><\/p>\n<p><em>(if you&#8217;re not seeing a gradient, your browser doesn&#8217;t support linear-gradient yet)<\/em><\/p>\n<p>So beautifully simple.<\/p>\n<h2>Simple Fail-safe for Older Browsers<\/h2>\n<pre><code>.grad{background-color:#09f;background:linear-gradient(#40b3ff, #09f)}<\/code><\/pre>\n<p><em>background-color:#09f<\/em> \u2014 Use this to set a solid background color for older browsers that do not support CSS3 gradients. Whatever the primary color of the gradient is suppose to be. Better than it just resolving to a default or transparent background.<\/p>\n<h2>Fully Cross-browser-friendly Version<\/h2>\n<p><em><a href=\"https:\/\/css-tricks.com\/css3-gradients\/\">https:\/\/css-tricks.com\/css3-gradients\/<\/a><\/em> \u2014 CSS-Tricks is a wonderful and rich site for web designers and this is a good technique. I personally just do not like using proprietary (browser-specific) code. I&#8217;m a purist in that sense.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Finally, the standard is here for creating non-browser-specific CSS gradients across all the latest, standards-compliant browsers! CSS .grad{background:linear-gradient(#40b3ff, #09f)} HTML &lt;a href=&quot;#&quot; class=&quot;grad&quot;&gt;Simple Gradient Hurray!&lt;\/a&gt; Demo Simple Gradient Hurray! (if you&#8217;re not seeing a gradient, your browser doesn&#8217;t support linear-gradient yet) So beautifully simple. Simple Fail-safe for Older Browsers .grad{background-color:#09f;background:linear-gradient(#40b3ff, #09f)} background-color:#09f \u2014 Use this <a href=\"https:\/\/webguy.io\/blog\/how-to-create-gradients-in-css\/\" class=\"more-link\">&#8230;<span class=\"screen-reader-text\">  How to Create Gradients in CSS<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,17,5],"tags":[239,254,278,218,281,206],"class_list":["post-2866","post","type-post","status-publish","format-standard","hentry","category-code","category-how-to","category-web-design","tag-code","tag-css","tag-css3","tag-how-to","tag-html","tag-web-design"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/posts\/2866","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/comments?post=2866"}],"version-history":[{"count":0,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/posts\/2866\/revisions"}],"wp:attachment":[{"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/media?parent=2866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/categories?post=2866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webguy.io\/blog\/wp-json\/wp\/v2\/tags?post=2866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}