Making a CSS button: positioning the text - HTML CSS CSS Form

HTML CSS examples for CSS Form:input button text

Description

Making a CSS button: positioning the text

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">

#button1 {<!--  www .  j a  va2  s  .  co  m-->
   background:lightblue;
   border-radius: 30px;
   width: 15em;
   height: 3em;
   position:relative;
   line-height:3em;
}
#button2 {
   background:lightblue;
   border-radius: 30px;
   width: 15em;
   height: 3em;
   position:relative;
   line-height:1.5em;
}
#button3 {
   background:lightblue;
   border-radius: 30px;
   width: 15em;
   height: 3em;
   position:relative;
   line-height:1em;
}
#button4 {
   background:lightblue;
   border-radius: 30px;
   width: 15em;
   height: 6em;
   position:relative;
   line-height:3em;
}
h1 {
   text-align: center;
}


      </style> 
 </head> 
 <body> 
  <div id="button1"> 
   <h1>One line</h1> 
  </div> 
  <div id="button2"> 
   <h1 style="font-size:150%;"> Two <br> Lines </h1> 
  </div> 
  <div id="button3"> 
   <h1 style="font-size:100%;"> Total <br> of <br> Three Lines! </h1> 
  </div> 
  <div id="button4"> 
   <h1> Two lines, <br> Twice the height </h1> 
  </div>  
 </body>
</html>

Related Tutorials