Create boxes of uniform size around image and text with HTML/CSS - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text

Description

Create boxes of uniform size around image and text with HTML/CSS

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">
body {<!--from w  w w.  j  a  va  2 s.  c o  m-->
   background:Chartreuse;
}

ul {
   list-style:none;
   font-family:arial, sans-serif;
   color:yellow;
   margin:0;
   padding:0;
}

.projbox {
   padding:41px 31px;
   background-color:blue;
   margin:11px;
   display:inline-block;
   box-sizing:border-box;
   height:601px;
   width:391px;
}

.projbox img {
   border:2px solid pink;
}

.projbox h2 {
   font-weight:normal;
   letter-spacing:2px;
   font-size:2.2em;
   margin:0.3em;
}

.projbox p {
   font-size:2em;
   margin:0.3em;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li class="projbox"> <img src="https://www.java2s.com/style/demo/Firefox.png" width="330" height="460"> <h2>Lorem ipsum </h2> <p>Lorem ipsum dolor sit </p> <p>Lorem ipsum dolor </p> </li> 
   <li class="projbox"> <img src="https://www.java2s.com/style/demo/Safari.png" width="330" height="460"> <h2>Lorem ipsum </h2> <p>Lorem ipsum dolor sit </p> <p>Lorem ipsum dolor </p> </li> 
  </ul>  
 </body>
</html>

Related Tutorials