Display: Inline-block positioning the element - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Display: Inline-block positioning the element

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>
body {<!--   w w  w.j a v a 2 s .  com-->
   background-color:Chartreuse;
}

h3 {
   font-family:sans-serif;
   text-align:center;
   color:yellow;
}

.forR {
   width:981px;
   padding-left:21px;
   margin-left:auto;
   margin-right:auto;
   margin-bottom:26px;
   padding-left:11px;
}

.inline {
   display:inline;
   position:relative;
}

.whitebox {
   background-color:blue;
   height:201px;
   display:inline-block;
}

.box1 {
   width:738px;
}
</style> 
 </head> 
 <body translate="no"> 
  <span> <h3>Lore</h3> 
   <div class="forR"> 
    <img src="https://www.java2s.com/style/demo/Safari.png" style="height:200px; width:200px; margin-right:10px; display:inline-block;"> 
    <div class="whitebox box1"> 
    </div> 
   </div> </span>  
 </body>
</html>

Related Tutorials