Declaring a Fallback Color in CSS

CSSWeb DevelopmentFront End Technology

Fallback color is used to specify the color for a situation when the browser doesn’t support RGBA colors. Some browsers that doesn’t support fallback colors are opera 9 and below, IE 8 and below etc. Specify a solid color before a RGBA color so the solid color can still work if the browser doesn’t support the RGBA colors.

Following is the code for declaring a fallback color in CSS −


 Live Demo

<!DOCTYPE html>
   font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
div {
   font-size: 24px;
   background-color: purple; /*fallback color*/
   background-color: rgba(128, 0, 128, 0.527);
<h1>Fallback color example</h1>
<div>Some random text inside this div</div>


The above code will produce the following output −

Published on 11-May-2020 12:56:46