HTML CSS examples for CSS Property:background-color
Heading background color with padding
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> *{ box-sizing: border-box; } .block{<!--from www .ja va 2 s . c o m--> margin: 50px; width: 400px; } .block span{ display: block; } h1, h2{ display: inline; } h1 span, h2 span { float: left; clear: both; padding: 10px; background: red; } </style> </head> <body> <div class="block"> <span> <h1> <span>Heading</span> </h1> </span> <h2> <span>Sub heading Sub heading Sub</span> <span>heading Sub heading Sub</span> <span>heading Sub heading</span> </h2> </div> </body> </html>