Create a disabled look of a button with CSS

CSSWeb DevelopmentFront End Technology

To create a disabled button look, use the CSS opacity property.

Example

You can try to run the following code to create a disabled look of a button −

Live Demo

<!DOCTYPE html>
<html>
    <head>
      <style>
         .btn1 {
            color: black;
            text-align: center;
            font-size: 15px;
         }
         .btn2 {
            color: black;
            text-align: center;
            font-size: 15px;
            opacity: 0.5;
         }
      </style>
   </head>
   <body>
      <h2>Result</h2>
      <p>Click below for result:</p>
      <button class = "btn1">Enabled</button>
      <button class = "btn2">Disabled</button>
   </body>
</html>
raja
Published on 23-May-2018 17:37:11
Advertisements