How to display link as button?

In this post we will learn how to display link as button by using CSS and below are the details.

  • Create one link <a>
  • Add class name as “button
  • Add below mentioned css to “button” class
  • Here display, text-decoration, text-align and background-color properties are required to display <a> as button on the page.
.button {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  background-color: #ccc;
  color: white;
  padding: 15px;
}
  • By adding above css class to link it will be displayed as button.