Add image caption to the left up corner - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Caption

Description

Add image caption to the left up corner

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">

#container {<!-- w  w w.j  a  v  a 2s  .  co  m-->
   margin: auto;
   width: 120px;
}
#img {
   margin-top: 20px;
   display: block;
   position:absolute;
}
#num {
   display: block;
   width: 40px;
   height: 30px;
   font-size: 16px;
   line-height: 30px;
   font-weight: bold;
   text-align: center;
   background-color: #f00;
   position:absolute;
   margin-left:-20px;
   margin-top: 5px;
   z-index:955;
}


      </style> 
 </head> 
 <body> 
  <div id="container"> 
   <img id="img" src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
   <span id="num"> 99+ </span> 
  </div>  
 </body>
</html>

Related Tutorials