HTML CSS examples for CSS Layout:Position
Positioning DIVs with CSS to right upper corner
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> html {<!-- www . ja v a 2 s . c o m--> background:Chartreuse; } .outer { background:yellow; border-radius:5px 5px 5px 5px; box-shadow:0 2px 2px blue; margin:0 auto; padding:21px 0px; position:relative; width:681px; text-align:center; margin-bottom:21px; } .inner { } h2 { position:absolute; top:0px; right:0px; margin:0; } h2 span { color:pink; font:bold 25px Helvetica, Sans-Serif; letter-spacing:-2px; background:OrangeRed; padding:0px 11px; } </style> </head> <body> <div class="outer"> <div class="inner"> <h2> <span>Lorem i</span> </h2> <img src="https://www.java2s.com/style/demo/Firefox.png"> </div> </div> </body> </html>