Centering 2 text elements on top of an image - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text

Description

Centering 2 text elements on top of an image

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">
.shop span {<!--from  w  w w. j  ava 2  s. c  o  m-->
   position:absolute;
   top:31%;
   left:51%;
   transform:translatex(-51%);
   white-space:nowrap;
}

.shop span p {
   padding:0;
}

.shop span .heading {
   color:Chartreuse;
   font-size:41px;
   text-shadow:0 0 11px yellow, 0 0 21px blue, 0 0 41px pink, 0 0 81px OrangeRed;
   font-weight:501;
}
</style> 
 </head> 
 <body> 
  <div class="shop"> 
   <img class="center-block" src="https://www.java2s.com/style/demo/Firefox.png"> 
   <span> <p class="sub-heading">Lorem ipsum</p> <p class="heading">Lorem ipsum dolor</p> </span> 
  </div>  
 </body>
</html>

Related Tutorials