In this tutorial we will see how to create Button like Links using CSS. CSS box-shadow property is the main property used in this code to create button like links.
Table of Contents
HTML Code
Simple HTML Code is given below, In this code we have a main ul tag which has three list items and inside those list items we have our main links. We will turn these links into buttons using simple CSS.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Button like Links using CSS</title>
</head>
<body>
<nav>
<ul>
<li><a href='#'>HOME</a></li>
<li><a href='#'>HTML</a></li>
<li><a href='#'>CSS</a></li>
</ul>
</nav>
</body>
</html>
CSS Code
CSS code is given below, In this code CSS box-shadow property is used to create the button like effect on the links. The CSS code of body tag is optional, it's only used to center align the nav tag, both vertically and horizontally.
* {
margin: 0;
padding: 0;
font-family: calibri, sans-serif; }
body {
background-color: #ccc;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
ul li {
display: inline-block;
margin:0px 5px;
}
ul li a {
color:#fff;
background-color: #1A73E8;
padding:10px;
box-shadow: 2px 2px 0px 5px #0C5DC7;
font-size: 20px;
text-decoration:none;
}
ul li a:hover {
background-color:#1164D1;
}
Demo
Video Tutorial
Watch video tutorial on Button like Links using CSS.