You can change Background color of headings h1, h2, h3 by writing this code.
1 2 3 4 5 |
h1, h2, h3 { background-color: #f0f0f0; /* Replace with your desired color */ padding: 10px; /* Optional: Adds some padding for better visibility */ border-radius: 5px; /* Optional: Adds rounded corners */ } |
Full code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<html lang="en"> <head> <style> /* CSS to style headings */ h1, h2, h3 { background-color: #f0f0f0; /* Light gray background */ color: #333; /* Text color */ padding: 10px; /* Add some space inside */ border-radius: 5px; /* Optional: Rounded corners */ text-align: center; /* Optional: Center the text */ } </style> </head> <body> <h1>This is an H1 Heading</h1> <h2>This is an H2 Heading</h2> <h3>This is an H3 Heading</h3> </body> </html> |