Right-aligned icon within button at any width - HTML CSS CSS Form

HTML CSS examples for CSS Form:input image button

Description

Right-aligned icon within button at any width

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

.btn {<!--  ww w .ja  v a  2  s  . c o m-->
   margin: 0;
   padding: 3px 6px;
   vertical-align: middle;
   border: none;
   background-color: #535B99;
   color: white;
   text-align: left;
   text-decoration: none;
   white-space: nowrap;
   cursor: pointer;
   text-transform: uppercase; }
   .btn [data-icon] {
      padding-left: 10px; }
      .btn [data-icon]:before {
         content: attr(data-icon); }


      </style> 
 </head> 
 <body> 
  <button class="btn"> Create Advert HELLO YOU ALL <span aria-hidden="true" data-icon="+"></span> </button>  
 </body>
</html>

Related Tutorials