HTML CSS examples for HTML Tag:h1-h6
Make span center to its <h2> parent
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> h2 {<!--from ww w .j a v a 2 s. c o m--> width:100%; text-align:center; border-bottom:2px solid Chartreuse; border-top:2px solid yellow; line-height:0.2em; margin:11px 0 21px; } h2 span { background:blue; padding:0 11px; } </style> </head> <body> <h2> <span>THIS IS A TEST</span> </h2> <p>this is some content</p> </body> </html>