ButtonsTutorials

how to create a plus button in CSS

how to create a plus button in CSS

how to create a plus button in CSS

Before We Start

Every developers need, clean and modern elements to develop their websites, It contain pictures and a user interface element within a website. The most important one and the first section that the user sees when he/she enters a website. how to create a plus button in CSS

So if you are a person who wishes to develop a website, you have to know how to create that properly.

how to create a plus button in CSS

We are here to solve your problem. In this article we discuss how to create this elements. Before we start please read the below articles which easier you to understand the process, if you are new to development.

Step 1 – Add HTML

It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag.

<div id="main">
  <div class="btnStyles">
    <div class="btnParent">
      <div class="rect">
        <div class="title"></div>
      </div>
    </div>
    <div class="btnParent">
      <div class="rect">
        <div class="title"></div>
      </div>
    </div>
  </div>
  <div class="AppGNB_6Button">
    <div class="AppGNB">
      <div class="bgGray"></div>
      <div class="bgGreen"></div>
      <div class="plusIcon">
        <div></div>
        <div></div>
      </div>
    </div>
  </div>
</div>

Step 2 – Add CSS

Copy and paste below code in your HTML editor between <style></style> tag.

<style>
@import url("https://fonts.googleapis.com/css?family=Roboto:700");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-user-select: none;
  user-select: none;
  -webkit-overflow-scrolling: touch;
  -ms-user-select: none;
  -moz-user-select: -moz-none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  user-select: none;
}
*,
*:before,
*:after {
  box-sizing: inherit;
}
html,
body {
  display: block;
  margin: 0;
  padding: 0;
  width: 375px;
  height: 812px;
  background-color: #222222;
  -webkit-overflow-scrolling: auto;
}

li {
  padding: 0;
  margin: 0;
  border: 0;
  background-color: #eaaee;
  font-weight: bold;
  bottom: 0;
  text-align: center;
}

#main {
  position: absolute;
  width: 290px;
  height: 364px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#main .AppGNB_6Button {
  position: absolute;
  left: 202px;
  top: 270px;
  cursor: pointer;
}

#main .AppGNB_6Button .AppGNB {
  position: absolute;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  width: 70px;
  height: 70px;
  border-radius: 100%;
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.15);
}

#main .AppGNB_6Button .AppGNB .bgGray {
  position: absolute;
  width: 70px;
  height: 70px;
  background-color: #474747;
}
#main .AppGNB_6Button .AppGNB .bgGreen {
  position: absolute;
  width: 70px;
  height: 70px;
  background: linear-gradient(
    to right bottom,
    #0ae102,
    #00df3c,
    #00dc58,
    #00d96d,
    #00d67f,
    #00d28e,
    #00ce9b,
    #00caa5,
    #00c4af,
    #00beb7,
    #00b8bc,
    #00b1bf
  );
  -webkit-transition: all 200ms cubic-bezier(0.33, 1, 0.68, 1);
  transition: all 200ms cubic-bezier(0.33, 1, 0.68, 1);
}
#main .AppGNB_6Button .AppGNB.on .bgGreen {
  opacity: 0;
}

#main .AppGNB_6Button .AppGNB .plusIcon {
  position: absolute;
  height: 30px;
  width: 30px;
  top: 20px;
  left: 20px;
  z-index: 100;
  -webkit-transition: all 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: all 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

#main .AppGNB_6Button .AppGNB.on .plusIcon {
  transform: rotate(calc(45deg * 3));
}

#main .AppGNB_6Button .AppGNB .plusIcon div:nth-child(1) {
  position: absolute;
  background: #ffffff;
  height: 30px;
  width: 3px;
  top: 0px;
  left: 13.5px;
}
#main .AppGNB_6Button .AppGNB .plusIcon div:nth-child(2) {
  position: absolute;
  background: #ffffff;
  height: 3px;
  width: 30px;
  top: 13.5px;
  left: 0px;
}

#main .btnStyles {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 290px;
  height: 224px;
  -webkit-transition: all 150ms cubic-bezier(0.33, 1, 0.68, 1);
  transition: all 150ms cubic-bezier(0.33, 1, 0.68, 1);
}

#main .btnStyles .btnParent {
  position: absolute;
  width: 290px;
  left: 0px;
  /* left: 190px;
  width: 100px; */
  height: 100px;
  border-radius: 56px;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  /* -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0); */
  /* box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.0);
  border: solid 1px rgba(0,0,0,0); */
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.15);
  border: solid 1px rgba(0, 0, 0, 0.07);
  transform-origin: 82% 50%;
  -webkit-transition: all 300ms cubic-bezier(0.33, 1, 0.68, 1);
  transition: all 300ms cubic-bezier(0.33, 1, 0.68, 1);
}
#main .btnStyles .btnParent {
}
#main .btnStyles.off {
  opacity: 0;
}

#main .btnStyles .btnParent:nth-child(1) {
  top: 0px;
  -webkit-transform: translate3d(0px, 50px, 0) scale(1);
  transform: translate3d(0px, 50px, 0) scale(1);
  opacity: 0;
}
#main .btnStyles .btnParent:nth-child(2) {
  top: 124px;
  -webkit-transform: translate3d(0px, 50px, 0) scale(1);
  transform: translate3d(0px, 50px, 0) scale(1);
  opacity: 0;
}
#main .btnStyles.on .btnParent:nth-child(1) {
  -webkit-transform: translate3d(0px, 0px, 0) scale(1);
  transform: translate3d(0px, 0px, 0) scale(1);
  opacity: 1;
}
#main .btnStyles.on .btnParent:nth-child(2) {
  -webkit-transform: translate3d(0px, 0px, 0) scale(1);
  transform: translate3d(0px, 0px, 0) scale(1);
  opacity: 1;
  -webkit-transition-delay: 50ms;
  transition-delay: 50ms;
}

#main .btnStyles .btnParent .rect {
  position: absolute;
  width: 290px;
  height: 100px;
  border-radius: 56px;

  overflow: hidden;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -webkit-transform: translate3d(0px, 0, 0);
  transform: translate3d(0px, 0, 0);
  -webkit-transition: all 150ms cubic-bezier(0.33, 1, 0.68, 1);
  transition: all 150ms cubic-bezier(0.33, 1, 0.68, 1);
}
#main .btnStyles .btnParent:nth-child(1) .rect {
  background: linear-gradient(90deg, #32afee 0%, #3282ee 100%);
}
#main .btnStyles .btnParent:nth-child(2) .rect {
  background: linear-gradient(90deg, #03c779 0%, #03c75a 100%);
}

/*  */
#main .btnStyles .btnParent .title {
  position: absolute;
  width: 250px;
  height: 100px;
  transform: translate3d(30px, 0, 0);
  opacity: 1;
  -webkit-transition: all 150ms cubic-bezier(0.33, 1, 0.68, 1);
  transition: all 150ms cubic-bezier(0.33, 1, 0.68, 1);
}
#main .btnStyles .btnParent:nth-child(1) .rect .title {
  background-size: contain;
}
#main .btnStyles .btnParent:nth-child(2) .rect .title {
  background-size: contain;
}
</style>

Step 3 – Add JavaScript

We use some external JavaScript link to this code. No need to worry about this, copy and paste below code between <head></head> tag.

<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>

At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want.Enjoy it.

Before

how to create a plus button in CSS

After

how to create a plus button in CSS

Video Tutorial

Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.


Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button