Image is on the border of parent's div - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image

Description

Image is on the border of parent's div

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
#main<!--   ww  w.ja va 2s.  c o m-->
 {
   border:11px solid Chartreuse;
   width:401px;
   position:relative;
}

.img-to-border
 {
   position:absolute;
   top:-11px;
   left:-11px;
}

.text {
   border:2px solid yellow;
   text-align:right;
   padding-right:31px;
}
</style> 
 </head> 
 <body> 
  <div id="main"> 
   <img src="https://www.java2s.com/style/demo/Google-Chrome.png" alt="" class="img-to-border"> 
   <p class="text">Lo</p> 
  </div>  
 </body>
</html>

Related Tutorials