{"id":5789,"date":"2015-07-21T12:15:44","date_gmt":"2015-07-21T09:15:44","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=5789"},"modified":"2018-01-08T14:16:51","modified_gmt":"2018-01-08T12:16:51","slug":"css-gradient-background-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/","title":{"rendered":"CSS Gradient Background Example"},"content":{"rendered":"<p>The aim of this example is to create and style gradient backgrounds.<\/p>\n<p>Gradients are typically one color that fades into another, but in CSS you can control every aspect of how that happens, from the direction to the colors (as many as you want) to where those color changes happen.<\/p>\n<p>CSS gradients are new types of <code>image<\/code> added in the CSS3 Image Module. Using CSS gradients lets you display smooth transitions between two or more specified colors. This lets you avoid using images for these effects, reducing download time and bandwidth usage.<\/p>\n<p>Browsers support two types of gradients: linear, defined with the <code>linear-gradient()<\/code> function, and radial, defined with <code>radial-gradient()<\/code>.<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;nAkUl5IbAjqlXSla&#8217;]<\/p>\n<h2>1. Basic Document Setup<\/h2>\n<p>Go ahead and create a new html document and add the basic sytnax in it like so:<\/p>\n<pre class=\"brush:xml\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;CSS3 Gradient Background Example&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;!-- STYLE SECTION --&gt;\r\n\r\n&lt;style type=\"text\/css\"&gt;\r\n\r\n&lt;\/style&gt;\r\n\r\n&lt;!-- HTML SECTION --&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>To set up our HTML, lets just add a div with some text inside, there is nothing else we need for now.<\/p>\n<pre class=\"brush:xml\">\r\n&lt;!-- HTML SECTION  --&gt;\r\n&lt;div class=\"gradient_nr\"&gt;Gradient Background&lt;\/div&gt;\r\n<\/pre>\n<p>Also, in your CSS code set up a box-like view of the current div.<\/p>\n<pre class=\"brush:css\">\r\n&lt;!-- STYLE  SECTION --&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\ndiv {\r\n    font-family: \"Raleway\";\r\n    margin: 5em;\r\n    width: 25em;\r\n    height: 8em;\r\n    border: 1px solid #ccc;\r\n    text-align: center;\r\n    line-height: 8em;\r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<p>For now, we&#8217;d have a box with a centered text, it is here inside the box that gradient backgrounds are going to be added.<br \/>\n<figure id=\"attachment_5800\" aria-describedby=\"caption-attachment-5800\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient1.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient1.jpg\" alt=\"Initial Element\" width=\"820\" height=\"185\" class=\"size-full wp-image-5800\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient1.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient1-300x68.jpg 300w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-5800\" class=\"wp-caption-text\">Initial Element<\/figcaption><\/figure><\/p>\n<h2>2. Linear Gradients<\/h2>\n<p>Gradients of this type can be applied using the syntax below (you can replace <code>background<\/code> with <code>background-image<\/code>) <code>background: linear-gradient(direction, color-stop1, color-stop2, ...);<\/code>.<\/p>\n<p>Let&#8217;s see an example of a gradient with two color stops and declared to be compatible with all browsers:<\/p>\n<pre class=\"brush:css\">\r\n&lt;!-- STYLE  SECTION --&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\ngradient1 {\r\n    background: -webkit-linear-gradient(green, blue); \/* For Safari 5.1 to 6.0 *\/\r\n    background: -o-linear-gradient(green, blue); \/* For Opera 11.1 to 12.0 *\/\r\n    background: -moz-linear-gradient(green, blue); \/* For Firefox 3.6 to 15 *\/\r\n    background: linear-gradient(green, blue); \/* Standard syntax (must be last) *\/\r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<p><figure id=\"attachment_5806\" aria-describedby=\"caption-attachment-5806\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient2.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient2.jpg\" alt=\"Two-Color Linear Gradient\" width=\"820\" height=\"185\" class=\"size-full wp-image-5806\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient2.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient2-300x68.jpg 300w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-5806\" class=\"wp-caption-text\">Two-Color Linear Gradient<\/figcaption><\/figure><br \/>\nNotice we haven&#8217;t set a direction for the gradient, that means the default one is top to bottom as you can see.<\/p>\n<p>Another example of a linear gradient would be a gradient with multiple color:<\/p>\n<pre class=\"brush:css\">\r\n&lt;!-- STYLE  SECTION --&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n.gradient2 {\r\n    background: -webkit-linear-gradient(green, blue, red); \/* For Safari 5.1 to 6.0 *\/\r\n    background: -o-linear-gradient(green, blue, red); \/* For Opera 11.1 to 12.0 *\/\r\n    background: -moz-linear-gradient(green, blue, red); \/* For Firefox 3.6 to 15 *\/\r\n    background: linear-gradient(green, blue, red); \/* Standard syntax (must be last) *\/\r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<figure id=\"attachment_5809\" aria-describedby=\"caption-attachment-5809\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient3.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient3.jpg\" alt=\"Three-Color Linear Gradient\" width=\"820\" height=\"185\" class=\"size-full wp-image-5809\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient3.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient3-300x68.jpg 300w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-5809\" class=\"wp-caption-text\">Three-Color Linear Gradient<\/figcaption><\/figure>\n<p>Enough with top to bottom directions. The following will show a left to right gradient, as easy as adding a <code>left<\/code> keyword before colors.<\/p>\n<pre class=\"brush:css\">\r\n&lt;!-- STYLE  SECTION --&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n.gradient3 {\r\n    background: -webkit-linear-gradient(left, darkorange, lightcoral, floralwhite); \r\n    background: -o-linear-gradient(left, darkorange, lightcoral, floralwhite);\r\n    background: -moz-linear-gradient(left, darkorange, lightcoral, floralwhite); \r\n    background: linear-gradient(left, darkorange, lightcoral, floralwhite); \r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<figure id=\"attachment_5811\" aria-describedby=\"caption-attachment-5811\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient4.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient4.jpg\" alt=\"Three-Color Linear Gradient with Left to Right Color Direction\" width=\"820\" height=\"185\" class=\"size-full wp-image-5811\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient4.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient4-300x68.jpg 300w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-5811\" class=\"wp-caption-text\">Three-Color Linear Gradient with Left to Right Color Direction<\/figcaption><\/figure>\n<p>But the direction keyword in not limited to one, we can have somehting like the following to create a diagonal gradient:<\/p>\n<pre class=\"brush:css\">\r\n&lt;!-- STYLE  SECTION --&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n.gradient4 {\r\n    background: -webkit-linear-gradient(left top, darkorange, lightcoral);\r\n    background: -o-linear-gradient(left top, darkorange, lightcoral); \r\n    background: -moz-linear-gradient(left top, darkorange, lightcoral); \r\n    background: linear-gradient(left top, darkorange, lightcoral); \r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<figure id=\"attachment_5814\" aria-describedby=\"caption-attachment-5814\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient5.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient5.jpg\" alt=\"Digaonal Three-Color Linear Gradient\" width=\"820\" height=\"185\" class=\"size-full wp-image-5814\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient5.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient5-300x68.jpg 300w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-5814\" class=\"wp-caption-text\">Digaonal Three-Color Linear Gradient<\/figcaption><\/figure>\n<p>The last example for this section will be a gradient, the direction of which is declared in degrees and colors in HEX.<\/p>\n<pre class=\"brush:css\">\r\n&lt;!-- STYLE  SECTION --&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n.gradient5 {\r\n    background: -webkit-linear-gradient(180deg, #b7e8f2, #90c7e6 );\r\n    background: -o-linear-gradient(180deg, #b7e8f2, #90c7e6 ); \r\n    background: -moz-linear-gradient(180deg, #b7e8f2, #90c7e6 ); \r\n    background: linear-gradient(180deg, #b7e8f2, #90c7e6); \r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<figure id=\"attachment_5817\" aria-describedby=\"caption-attachment-5817\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient6.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient6.jpg\" alt=\"Two-color Linear Gradient with a 180deg Direction\" width=\"820\" height=\"185\" class=\"size-full wp-image-5817\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient6.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient6-300x68.jpg 300w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-5817\" class=\"wp-caption-text\">Two-color Linear Gradient with a 180deg Direction<\/figcaption><\/figure>\n<h2>3. Radial Gradients<\/h2>\n<p>A radial gradient is defined by its center. You must declare at least two colors for it to work. The syntax would be:<br \/>\n<code>background: radial-gradient(shape size at position, start-color, ..., last-color);<\/code><\/p>\n<p>Let&#8217;s start with a radial gradient made of three colors set in hexadecimal.<\/p>\n<pre class=\"brush:css\">\r\n&lt;!-- STYLE  SECTION --&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n.gradient6 {\r\n    background: -webkit-radial-gradient(#FF530D, #E82C0C, #E80C7A); \/* Safari 5.1 to 6.0 *\/\r\n    background: -o-radial-gradient(#FF530D, #E82C0C, #E80C7A); \/* For Opera 11.6 to 12.0 *\/\r\n    background: -moz-radial-gradient(#FF530D, #E82C0C, #E80C7A); \/* For Firefox 3 to 15 *\/\r\n    background: radial-gradient(#FF530D, #E82C0C, #E80C7A); \/* Standard syntax *\/\r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<figure id=\"attachment_5819\" aria-describedby=\"caption-attachment-5819\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient7.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient7.jpg\" alt=\"Three-Color Radial Gradient\" width=\"820\" height=\"185\" class=\"size-full wp-image-5819\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient7.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient7-300x68.jpg 300w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-5819\" class=\"wp-caption-text\">Three-Color Radial Gradient<\/figcaption><\/figure>\n<p>Next, we&#8217;ll see a gradient that doesn&#8217;t have equal space between color steps. Instead, we decide how much space each color uses.<\/p>\n<pre class=\"brush:css\">\r\n&lt;!-- STYLE  SECTION --&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n.gradient7 {\r\n    background: -webkit-radial-gradient(#E8E37B 5%, #DBE899 15%, #62EEFF 80%); \r\n    background: -o-radial-gradient(#E8E37B 5%, #DBE899 15%, #62EEFF 80%); \r\n    background: -moz-radial-gradient(#E8E37B 5%, #DBE899 15%, #62EEFF 80%); \r\n    background: radial-gradient(#E8E37B 5%, #DBE899 15%, #62EEFF 80%); \r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<figure id=\"attachment_5821\" aria-describedby=\"caption-attachment-5821\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient8.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient8.jpg\" alt=\"Three-Color Radial Gradient with Differently Spaced Colors\" width=\"820\" height=\"185\" class=\"size-full wp-image-5821\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient8.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient8-300x68.jpg 300w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-5821\" class=\"wp-caption-text\">Three-Color Radial Gradient with Differently Spaced Colors<\/figcaption><\/figure>\n<p>Last but not least, you can define shapes which will guide the gradient colors.<\/p>\n<pre class=\"brush:css\">\r\n&lt;!-- STYLE  SECTION --&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n.gradient8 {\r\n    background: -webkit-radial-gradient(circle, #DEE8AE, #B097E8,#FF9134);\r\n    background: -o-radial-gradient(circle, #DEE8AE, #B097E8,#FF9134);\r\n    background: -moz-radial-gradient(circle, #DEE8AE, #B097E8,#FF9134); \r\n    background: radial-gradient(circle, #DEE8AE, #B097E8,#FF9134);\r\n}\r\n&lt;\/style&gt;\r\n<\/pre>\n<figure id=\"attachment_5823\" aria-describedby=\"caption-attachment-5823\" style=\"width: 820px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient9.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient9.jpg\" alt=\"Three-Color Radial Gradient with Circle Shape Defined\" width=\"820\" height=\"185\" class=\"size-full wp-image-5823\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient9.jpg 820w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/gradient9-300x68.jpg 300w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><figcaption id=\"caption-attachment-5823\" class=\"wp-caption-text\">Three-Color Radial Gradient with Circle Shape Defined<\/figcaption><\/figure>\n<h2>4. Conclusion<\/h2>\n<p>To conclude, it is clear that gradients are an easy and fancy way to style your backrounds around the page. There are even<br \/>\nmore tools like gradient repeating that you can try. Additionally, there are dozens of websites that let you style color<br \/>\nbased gradients in a graphical way and then give you the CSS for that.<\/p>\n<p>A website I would recommend is <a href=\"http:\/\/www.cssmatic.com\/gradient-generator\" target=\"_blank\">CSS Matic<\/a>. However, if you feel creative enough to style your own gradients, that is better and helps you understand.<\/p>\n<p>Gradients are the best way to avoid images that show the same in terms of performance and readability.<\/p>\n<h2>5. Download<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/07\/CSS3-Gradient-Background.zip\"><strong>CSS3 Gradient Background<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The aim of this example is to create and style gradient backgrounds. Gradients are typically one color that fades into another, but in CSS you can control every aspect of how that happens, from the direction to the colors (as many as you want) to where those color changes happen. CSS gradients are new types &hellip;<\/p>\n","protected":false},"author":75,"featured_media":917,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-5789","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-css"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CSS Gradient Background Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"The aim of this example is to create and style gradient backgrounds. Gradients are typically one color that fades into another, but in CSS you can control\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS Gradient Background Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"The aim of this example is to create and style gradient backgrounds. Gradients are typically one color that fades into another, but in CSS you can control\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/fabiocimo\" \/>\n<meta property=\"article:published_time\" content=\"2015-07-21T09:15:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-08T12:16:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Fabio Cimo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fabiocimo\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fabio Cimo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/\"},\"author\":{\"name\":\"Fabio Cimo\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22\"},\"headline\":\"CSS Gradient Background Example\",\"datePublished\":\"2015-07-21T09:15:44+00:00\",\"dateModified\":\"2018-01-08T12:16:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/\"},\"wordCount\":638,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\",\"articleSection\":[\"CSS\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/\",\"name\":\"CSS Gradient Background Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\",\"datePublished\":\"2015-07-21T09:15:44+00:00\",\"dateModified\":\"2018-01-08T12:16:51+00:00\",\"description\":\"The aim of this example is to create and style gradient backgrounds. Gradients are typically one color that fades into another, but in CSS you can control\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/css\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"CSS Gradient Background Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22\",\"name\":\"Fabio Cimo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g\",\"caption\":\"Fabio Cimo\"},\"description\":\"Fabio is a passionate student in web tehnologies including front-end (HTML\/CSS) and web design. He likes exploring as much as possible about the world wide web and how it can be more productive for us all. Currently he studies Computer Engineering, at the same time he works as a freelancer on both web programming and graphic design.\",\"sameAs\":[\"https:\/\/www.facebook.com\/fabiocimo\",\"https:\/\/al.linkedin.com\/in\/fabiocimo\",\"https:\/\/x.com\/fabiocimo\",\"https:\/\/www.youtube.com\/fabiocimo1\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/fabio-cimo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CSS Gradient Background Example - Web Code Geeks - 2026","description":"The aim of this example is to create and style gradient backgrounds. Gradients are typically one color that fades into another, but in CSS you can control","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/","og_locale":"en_US","og_type":"article","og_title":"CSS Gradient Background Example - Web Code Geeks - 2026","og_description":"The aim of this example is to create and style gradient backgrounds. Gradients are typically one color that fades into another, but in CSS you can control","og_url":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_author":"https:\/\/www.facebook.com\/fabiocimo","article_published_time":"2015-07-21T09:15:44+00:00","article_modified_time":"2018-01-08T12:16:51+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","type":"image\/jpeg"}],"author":"Fabio Cimo","twitter_card":"summary_large_image","twitter_creator":"@fabiocimo","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Fabio Cimo","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/"},"author":{"name":"Fabio Cimo","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22"},"headline":"CSS Gradient Background Example","datePublished":"2015-07-21T09:15:44+00:00","dateModified":"2018-01-08T12:16:51+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/"},"wordCount":638,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","articleSection":["CSS"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/","url":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/","name":"CSS Gradient Background Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","datePublished":"2015-07-21T09:15:44+00:00","dateModified":"2018-01-08T12:16:51+00:00","description":"The aim of this example is to create and style gradient backgrounds. Gradients are typically one color that fades into another, but in CSS you can control","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/css3-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/css\/css-gradient-background-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"CSS","item":"https:\/\/www.webcodegeeks.com\/category\/css\/"},{"@type":"ListItem","position":3,"name":"CSS Gradient Background Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/1dfb88b4a8d08c37a6080311fd330a22","name":"Fabio Cimo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b3df055f2e1b62e238889fafbb16121c68aab1adcd11af670e185cafae201b3b?s=96&d=mm&r=g","caption":"Fabio Cimo"},"description":"Fabio is a passionate student in web tehnologies including front-end (HTML\/CSS) and web design. He likes exploring as much as possible about the world wide web and how it can be more productive for us all. Currently he studies Computer Engineering, at the same time he works as a freelancer on both web programming and graphic design.","sameAs":["https:\/\/www.facebook.com\/fabiocimo","https:\/\/al.linkedin.com\/in\/fabiocimo","https:\/\/x.com\/fabiocimo","https:\/\/www.youtube.com\/fabiocimo1"],"url":"https:\/\/www.webcodegeeks.com\/author\/fabio-cimo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/5789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/75"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=5789"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/5789\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/917"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=5789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=5789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=5789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}