Skip to content

Instantly share code, notes, and snippets.

@melanyss
Forked from Techgokul/like&dislike.html
Created May 19, 2020 12:52
Show Gist options
  • Save melanyss/b69b9f3827dcb66904af73e6f36a8c5d to your computer and use it in GitHub Desktop.
Save melanyss/b69b9f3827dcb66904af73e6f36a8c5d to your computer and use it in GitHub Desktop.
Create a Like and Dislike Button using html,css and js
<html>
<head>
<title>Like and Dislike</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
<style>
.fa{
font-size: 300px;
color: white;
cursor: pointer;
width: 400px;
height: 400px;
background-color: cornflowerblue;
border-radius: 100%;
line-height: 400px;
text-align: center;
}
.fa:hover{
color: khaki;
}
</style>
</head>
<body>
<i onclick="myfunction(this)" class="fa fa-thumbs-up"><a type="text" id="show"></a></i>
<script>
function myfunction(x)
{
x.classList.toggle("fa-thumbs-down");
}
</script>
</body>
</html>
@Harsh-2002
Copy link

Hey, Can you add a number count for like and dislike?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment