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

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

WBOY
Release: 2023-08-27 10:17:02
forward
714 people have browsed it

如何使用 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>
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template