Button With ASCII Character Using CSS3

Language

Good Day!!!

In this tutorial, we are going to learn How To Make Button With ASCII Character Using CSS3. You can used it for the admin panel which is the add, edit, delete, save and mail. In this project we are not using Glyphicons of Bootsrap, Icon or Image instead we will use ASCII Character Using CSS3. It will display the corresponding symbol.

Directions:

For Button - Design

  1. .btn_style {
  2.         display: inline-block;
  3.         white-space: nowrap;
  4.         background-color: #ddd;
  5.         background-image: -webkit-gradient(linear, left top, left bottom, from(#09F), to(#09F));
  6.         background-image: -webkit-linear-gradient(top, #1aebdf, chocolate);
  7.         background-image: -moz-linear-gradient(top, #0095DD, #0052A4);
  8.         background-image: -ms-linear-gradient(top, #0095DD, #0052A4);
  9.         background-image: -o-linear-gradient(top, #0095DD, #0052A4);
  10.         background-image: linear-gradient(top, #0095DD, #0052A4);
  11.         border: 1px groove blue;
  12.         padding: 0 1.5em;
  13.         margin: 0.5em;
  14.         font: bold 1em/2em Arial, Helvetica;
  15.         text-decoration: none;
  16.         color: #FFF;
  17.         -moz-border-radius: 5px;
  18.         -webkit-border-radius: 5px;
  19.         border-radius: 5px;
  20.         text-align: center;
  21. }
  22.  
  23. .btn_style:hover {
  24.         color:chocolate;
  25.         border: 1px groove red;
  26.         background-color: #1aebdf;
  27.         background-image: -webkit-gradient(linear, left top, left bottom, from(#1aebdf), to(#1aebdf));
  28.         background-image: -webkit-linear-gradient(top, #1aebdf, #1aebdf);
  29.         background-image: -moz-linear-gradient(top, #1aebdf, #1aebdf);
  30.         background-image: -ms-linear-gradient(top, #1aebdf, #1aebdf);
  31.         background-image: -o-linear-gradient(top, #1aebdf, #1aebdf);
  32.         background-image: linear-gradient(top, #1aebdf, #1aebdf);
  33. }
  34.  
  35. .btn_style:before {
  36.         background: #ccc;
  37.         background: rgba(0,0,0,.1);
  38.         float: left;
  39.         width: 1em;
  40.         text-align: center;
  41.         font-size: 1.5em;
  42.         margin: 0 1em 0 -1em;
  43.         padding: 0 .2em;
  44.         -moz-box-shadow: 1px 0 0 rgba(0,0,0,.5), 2px 0 0 rgba(255,255,255,.5);
  45.         -webkit-box-shadow: 1px 0 0 rgba(0,0,0,.5), 2px 0 0 rgba(255,255,255,.5);
  46.         box-shadow: 1px 0 0 rgba(0,0,0,.5), 2px 0 0 rgba(255,255,255,.5);
  47.         -moz-border-radius: .15em 0 0 .15em;
  48.         -webkit-border-radius: .15em 0 0 .15em;
  49.         border-radius: .15em 0 0 .15em;
  50.         pointer-events: none;
  51. }

For Button - ASCII Character

  1. /* for the icons */
  2.  
  3. .add:before {
  4.         content: "\271A";
  5. }
  6.  
  7. .edit:before {
  8.         content: "\270E";
  9. }
  10.  
  11. .delete:before {
  12.         content: "\2718";
  13. }
  14.  
  15. .save:before {
  16.         content: "\2714";
  17. }
  18.  
  19. .email:before {
  20.         content: "\2709";
  21. }

For HTML Code

  1. <div align="center">
  2. <table border="1" class="table_style">
  3.         <tr>
  4.                 <td colspan="6">
  5.                         <h1>
  6.                                 CSS3 Button
  7.                         </h1>
  8.                 </td>
  9.         </tr>
  10.         <tr>
  11.                 <td>
  12.                         <a href="#" class="btn_style">Button</a>
  13.                 </td>
  14.                 <td>
  15.                         <a href="#" class="btn_style add">Add</a>
  16.                 </td>
  17.                 <td>
  18.                         <a href="#" class="btn_style edit">Edit</a>
  19.                 </td>
  20.                 <td>
  21.                         <a href="#" class="btn_style delete">Delete</a>
  22.                 </td>
  23.                 <td>
  24.                         <a href="#" class="btn_style save">Save</a>
  25.                 </td>
  26.                 <td>
  27.                         <a href="" class="btn_style email">Email</a>
  28.                 </td>
  29.         </tr>
  30.         <tr>
  31.                 <td>
  32.                         <span>
  33.                                 Button
  34.                         </span>
  35.                 </td>
  36.                 <td>
  37.                         <span>
  38.                                 Button Add
  39.                         </span>
  40.                 </td>
  41.                 <td>
  42.                         <span>
  43.                                 Button Edit
  44.                         </span>
  45.                 </td>
  46.                 <td>
  47.                         <span>
  48.                                 Button Delete
  49.                         </span>
  50.                 </td>
  51.                 <td>
  52.                         <span>
  53.                                 Button Save
  54.                         </span>
  55.                 </td>
  56.                 <td>
  57.                         <span>
  58.                                 Button Email
  59.                         </span>
  60.                 </td>
  61.         </tr>
  62. </div>

Full Source Code

  1. <!DOCTYPE html>
  2. <title>CSS3 Button</title>
  3. <style type="text/css">
  4. .btn_style {
  5.         display: inline-block;
  6.         white-space: nowrap;
  7.         background-color: #ddd;
  8.         background-image: -webkit-gradient(linear, left top, left bottom, from(#09F), to(#09F));
  9.         background-image: -webkit-linear-gradient(top, #1aebdf, chocolate);
  10.         background-image: -moz-linear-gradient(top, #0095DD, #0052A4);
  11.         background-image: -ms-linear-gradient(top, #0095DD, #0052A4);
  12.         background-image: -o-linear-gradient(top, #0095DD, #0052A4);
  13.         background-image: linear-gradient(top, #0095DD, #0052A4);
  14.         border: 1px groove blue;
  15.         padding: 0 1.5em;
  16.         margin: 0.5em;
  17.         font: bold 1em/2em Arial, Helvetica;
  18.         text-decoration: none;
  19.         color: #FFF;
  20.         -moz-border-radius: 5px;
  21.         -webkit-border-radius: 5px;
  22.         border-radius: 5px;
  23.         text-align: center;
  24. }
  25.  
  26. .btn_style:hover {
  27.         color:chocolate;
  28.         border: 1px groove red;
  29.         background-color: #1aebdf;
  30.         background-image: -webkit-gradient(linear, left top, left bottom, from(#1aebdf), to(#1aebdf));
  31.         background-image: -webkit-linear-gradient(top, #1aebdf, #1aebdf);
  32.         background-image: -moz-linear-gradient(top, #1aebdf, #1aebdf);
  33.         background-image: -ms-linear-gradient(top, #1aebdf, #1aebdf);
  34.         background-image: -o-linear-gradient(top, #1aebdf, #1aebdf);
  35.         background-image: linear-gradient(top, #1aebdf, #1aebdf);
  36. }
  37.  
  38. .btn_style:before {
  39.         background: #ccc;
  40.         background: rgba(0,0,0,.1);
  41.         float: left;
  42.         width: 1em;
  43.         text-align: center;
  44.         font-size: 1.5em;
  45.         margin: 0 1em 0 -1em;
  46.         padding: 0 .2em;
  47.         -moz-box-shadow: 1px 0 0 rgba(0,0,0,.5), 2px 0 0 rgba(255,255,255,.5);
  48.         -webkit-box-shadow: 1px 0 0 rgba(0,0,0,.5), 2px 0 0 rgba(255,255,255,.5);
  49.         box-shadow: 1px 0 0 rgba(0,0,0,.5), 2px 0 0 rgba(255,255,255,.5);
  50.         -moz-border-radius: .15em 0 0 .15em;
  51.         -webkit-border-radius: .15em 0 0 .15em;
  52.         border-radius: .15em 0 0 .15em;
  53.         pointer-events: none;
  54. }
  55.  
  56. .table_style {
  57.         text-align:center;
  58.         border:3px groove #CCC;
  59. }
  60.  
  61. span {
  62.         color:red;
  63.         font-weight:bold;
  64.         font-size:20px;
  65. }
  66.  
  67. h1 {
  68.         color:blue;
  69. }
  70.  
  71. /* for the icons */
  72.  
  73. .add:before {
  74.         content: "\271A";
  75. }
  76.  
  77. .edit:before {
  78.         content: "\270E";
  79. }
  80.  
  81. .delete:before {
  82.         content: "\2718";
  83. }
  84.  
  85. .save:before {
  86.         content: "\2714";
  87. }
  88.  
  89. .email:before {
  90.         content: "\2709";
  91. }
  92. </head>
  93. <div align="center">
  94. <table border="1" class="table_style">
  95.         <tr>
  96.                 <td colspan="6">
  97.                         <h1>
  98.                                 CSS3 Button
  99.                         </h1>
  100.                 </td>
  101.         </tr>
  102.         <tr>
  103.                 <td>
  104.                         <a href="#" class="btn_style">Button</a>
  105.                 </td>
  106.                 <td>
  107.                         <a href="#" class="btn_style add">Add</a>
  108.                 </td>
  109.                 <td>
  110.                         <a href="#" class="btn_style edit">Edit</a>
  111.                 </td>
  112.                 <td>
  113.                         <a href="#" class="btn_style delete">Delete</a>
  114.                 </td>
  115.                 <td>
  116.                         <a href="#" class="btn_style save">Save</a>
  117.                 </td>
  118.                 <td>
  119.                         <a href="" class="btn_style email">Email</a>
  120.                 </td>
  121.         </tr>
  122.         <tr>
  123.                 <td>
  124.                         <span>
  125.                                 Button
  126.                         </span>
  127.                 </td>
  128.                 <td>
  129.                         <span>
  130.                                 Button Add
  131.                         </span>
  132.                 </td>
  133.                 <td>
  134.                         <span>
  135.                                 Button Edit
  136.                         </span>
  137.                 </td>
  138.                 <td>
  139.                         <span>
  140.                                 Button Delete
  141.                         </span>
  142.                 </td>
  143.                 <td>
  144.                         <span>
  145.                                 Button Save
  146.                         </span>
  147.                 </td>
  148.                 <td>
  149.                         <span>
  150.                                 Button Email
  151.                         </span>
  152.                 </td>
  153.         </tr>
  154. </div>
  155. </body>
  156. </html>
So what can you say about this work? Share your thoughts in the comment section below or email me at [email protected]. Practice Coding. Thank you.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment