HTML CSS examples for CSS Property:background-color
Set background-color on heading with pseudo-element
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> div{<!-- www.j a va 2 s.co m--> width: 300px; margin: 0 auto; } h3{ font-size: 200%; background-color: hsl(0, 0%, 100%); margin: 0px; position: relative; overflow: hidden; } h3::after{ content: ''; position: absolute; width: 100%; height: 100%; margin-left: 20px; background: hsl(200, 30%, 20%); } </style> </head> <body> <div> <h3>TEST</h3> <p>blah blah blah blah blah blah blah blah blah blah blah</p> <h3>TEST 2</h3> <p>blah blah blah blah blah blah blah blah blah blah blah</p> </div> </body> </html>