position image next to text with padding - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text Position

Description

position image next to text with padding

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">
h2 {<!--from  w  ww. j ava  2 s .  c  o m-->
   overflow:auto;
}

h2 span {
   float:left;
   margin-top:11px;
   margin-left:11px;
}

h2 img {
   float:left;
}
</style> 
 </head> 
 <body> 
  <h2> <img src="https://www.java2s.com/style/demo/Google-Chrome.png" height="75px"> <span>Lorem ips</span> </h2>  
 </body>
</html>

Related Tutorials