Generate a blue box behind the first letter of a word - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Box

Description

Generate a blue box behind the first letter of a word

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">
.FirstLetter:first-letter {<!-- ww w.j a  va  2s . c  o m-->
   font-family:arial;
   font-size:15pt;
   font-weight:bold;
   color:Chartreuse;
   background:Blue;
   border:2px solid yellow;
   padding-top:9px;
   padding-left:9px;
   padding-bottom:4px;
}

.Spaced {
   letter-spacing:6px;
   font-family:arial;
   font-size:15pt;
   font-weight:bold;
}
</style> 
 </head> 
 <body> 
  <div class="FirstLetter Spaced headerFont">
    Lorem ipsum dolor s 
  </div> 
  <!--[if lt IE 8]>
<style>
.FirstLetter:first-letter {padding-top:12px; padding-bottom:7px}
</style>
<![endif]-->  
 </body>
</html>

Related Tutorials