Aligning image on top, and text to the bottom-right inside div container - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text Alignment

Description

Aligning image on top, and text to the bottom-right inside div container

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">
#outer {<!--   w  w w. j  av  a 2s. co m-->
   border:2px solid Chartreuse;
   width:501px;
   text-align:right;
   vertical-align:bottom;
   display:table-cell;
   position:relative;
   padding-top:201px;
   height:301px;
}

img {
   width:100%;
   height:201px;
   position:absolute;
   top:0;
   left:0;
}

p {
   margin:0;
}
</style> 
 </head> 
 <body> 
  <div id="outer"> 
   <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> This is a cat. Look at it closely, for it is not a dog. 
  </div>  
 </body>
</html>

Related Tutorials