Popup Subscribe Button using HTML & CSS

Popup Subscribe Button using HTML & CSS

Hello developers, today in this blog, you'll learn to create a Popup Subscribe Button using HTML & CSS.

Subscribe button is the type of button or medium to follow and get regular updates or notifications of that particular person's work. For example, you have subscribed to our blog. It helps notify you when we upload a new post on our blog.

In this blog (Popup Subscribe Button) on the webpage, there is a card or box at the top center of the webpage. The popup box contains a logo on the left side and, on the right side, there are some text and a subscribe button. There is a cross button for hiding the toast notification. When you click on the cross button, the popup will disappear by going to the right side of the webpage. It is made by using CSS animation property.

The source code of this Popup Subscribe Button is given below, if you want the source code of this program, you can copy it. You can use this Popup Subscribe Button with your creativity and take this project to the next level.

Popup Subscribe Button [Source Code]

To make this website, you would like to make two files: an HTML file & a CSS file. First, create an HTML file with the name of index.html and remember, you have to create a file with a .html extension.

<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title> Popup Subscribe Button || Learningrobo </title> <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div class="container"> <input type="radio" id="hide"> <div class="box"> <label for="hide"><i class="fas fa-times"></i></label> <div class="logo"> <img src="https://cdn.pixabay.com/photo/2020/06/24/05/23/tree-5334773__340.png" alt=""> </div> <div class="right"> <div class="text-1">LearningRobo</div> <div class="text-2">Subscribe Our Blog</div> <a href="https://www.learningrobo.com" target="_blank">Subscribe</a> </div> </div> </div> <div class="credit">Made with <span style="color:#9867c5;font-size:20px;">❤</span> by <a href="https://www.learningrobo.com/">Learning Robo</a></div> </body> </html>
CSS provides style to an HTML page. To make the page attractive, create a CSS file with the name style.css, and remember that you have to make a file with a .css extension.


@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}
body{
  height: 100vh;
  background: #f2f2f2;
  overflow: hidden;
}
.container{
  margin-top: 30px;
  display: flex;
  align-content: center;
  justify-content: center;
}

.container .box{
  background: #fff;
  display: flex;
  align-items: center;
  border-radius: 6px;
  padding: 25px 35px 25px 35px;
  box-shadow:0px 0px 10px 2px rgba(0,0,0,0.1);
  position: relative;
  animation: show_box 0.8s ease forwards;
}
@keyframes show_box {
  0%{
    transform: translateX(100%);
  }
  40%{
    transform: translateX(-5%);
  }
  80%{
    transform: translateX(0%);
  }
  100%{
    transform: translateX(-10px);
  }
}
#hide:checked ~ .box{
  animation: hide_box 0.8s ease forwards;
}
@keyframes hide_box {
  0%{
    transform: translateX(0%);
  }
  40%{
    transform: translateX(5%);
  }
  80%{
    transform: translateX(0%);
  }
  100%{
    transform: translateX(calc(100% + 550px ));
  }
}
.container .box i{
  position: absolute;
  right: 15px;
  top: 10px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
}
.container i:hover{
  color: #000;
}
.container .logo{
  height: 90px;
  width: 90px;
  margin-right: 15px;
}
.container .logo img{
  height: 100%;
  width: 100%;
  object-fit: cover;
}
.box .right{
  display: flex;
  flex-direction: column;
}
.box .right .text-1{
  font-size: 18px;
  font-weight: 600;
  color: #333;
}
.box .right .text-2{
  font-size: 14px;
  color: #666;
  margin: 2px 0 8px 0;
}
.box .right a{
  font-size: 18px;
  font-weight: 500;
  display: block;
  padding: 8px 0;
  background: #9867c5;
  border-radius: 6px;
  color: #fff;
  text-align: center;
  text-decoration: none;
  transition: all 0.4s ease;
}
.box .right a:hover{
  background-color: #B721FF;
}
.container #hide{
  display: none;
} 
.credit a{
  text-decoration: none;
  color: #000;
  font-weight: 800;
}
.credit {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  margin: 10px;
  color:#000;
  text-align: center;
}
We hope you will like this Popup Subscribe Button using HTML & CSS.

Thank you for reading our blog. If you face any problem creating this Popup Subscribe Button using HTML & CSS, then contact us or comment us. We'll try to provide a solution to your problem as soon as possible.

Thank you
Learning robo team

إرسال تعليق

Thank you
Learning robo team

Post a Comment (0)

أحدث أقدم
Learning Robo says...
code copied
Welcome