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 −
Example
<!DOCTYPE html>
<html>
<head>
<style>
body{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
div {
padding:20px;
font-size: 24px;
background-color: purple; /*fallback color*/
background-color: rgba(128, 0, 128, 0.527);
color:white;
}
</style>
</head>
<body>
<h1>Fallback color example</h1>
<div>Some random text inside this div</div>
</body>
</html>Output
The above code will produce the following output −
