Home  >  Article  >  Web Front-end  >  How to add a colored border to a button using CSS?

How to add a colored border to a button using CSS?

WBOY
WBOYforward
2023-08-27 10:17:02696browse

如何使用 CSS 为按钮添加彩色边框?

To add a colored border, use the CSS border property.

Example

You can try running the following code to add a colored border.

Real-time demonstration

<!DOCTYPE html>
<html>
   <head>
      <style>
         .button {
            background-color: yellow;
            color: black;
            text-align: center;
            font-size: 15px;
            padding: 20px;
            border-radius: 15px;
            border: 3px dashed blue;
         }
      </style>
   </head>
   <body>
      <h2>Result</h2>
      <p>Click below for result:</p>
      <button class = "button">Result</button>
   </body>
</html>

The above is the detailed content of How to add a colored border to a button using CSS?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete
Previous article:CSS @import Usage: RulesNext article:CSS @import Usage: Rules