ButtonsTutorials

how to create a Simple Button Styles

how to create a Simple Button Styles

how to create a Simple Button Styles

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 Simple Button Styles

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 Simple Button Styles

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 class='container'>

  <p>
    <div class="button-container">
      <div class='button -regular center'>Let's start</div>

      <div class='button -dark center'>Touch me</div>

      <div class='button -green center'>Just like that</div>

      <div class='button -blue center'>And that, oh, yeah</div>

      <div class='button -salmon center'>Now that I like</div>

      <div class='button -sun center'>God, that's so nice</div>

      <div class='button -alge center'>Now lower down</div>

      <div class='button -flower center'>Where the figs lie</div>

    </div>
</div>

Step 2 – Add CSS

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

<style>
:root {
  --color-dark: #161616;
  --color-ocean: #416dea;
  --color-grass: #3dd28d;
  --color-snow: #FFFFFF;
  --color-salmon: #F32C52;
  --color-sun: #feee7d;
  --color-alge: #7999a9;
  --color-flower: #353866;
  --color-smoke: #e4e4e4;
  --borderRadius: 36px;
  --font-face: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  display: -webkit-box;
  display: flex;
  box-sizing: border-box;
  min-height: 100vh;
  background: #3aafb4;
  background: -webkit-gradient(linear, left top, right top, from(#3aafb4), color-stop(100%, #1d1efd), to(#fcb045));
  background: linear-gradient(90deg, #3aafb4 0%, #1d1efd 100%, #fcb045 100%);
  font-family: var(--font-face);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: center;
          align-items: center;
}
@media (min-width: 992px) {
  body {
    border-width: 30px;
  }
}

body.linked .button, body.linked h1 {
  opacity: .3;
  -webkit-transition: opacity 300ms linear;
  transition: opacity 300ms linear;
}
body.linked p {
  color: var(--color-smoke);
  -webkit-transition: color 300ms linear;
  transition: color 300ms linear;
}

h1 {
  text-align: center;
  -webkit-transition: opacity 300ms linear;
  transition: opacity 300ms linear;
  color: var(--color-dark);
  font-family: var(--font-face);
  font-size: 32px;
  font-weight: 700;
}
h1 span {
  font-weight: 400;
}

p {
  max-width: 460px;
  margin: 0 auto;
  -webkit-transition: color 300ms linear;
  transition: color 300ms linear;
  text-align: center;
  color: var(--color-dark);
  font-weight: 400;
  line-height: 1.5;
}

a, a:visited {
  text-decoration: none;
  color: var(--color-ocean);
  font-weight: 500;
}
a:hover, a:visited:hover {
  text-decoration: underline;
  color: var(--color-ocean);
}

.container {
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
          flex-direction: column;
  width: 100%;
  padding: 20px;
}

.button-container {
  display: -webkit-box;
  display: flex;
  margin: 60px auto;
  flex-wrap: wrap;
  -webkit-box-pack: center;
          justify-content: center;
}

.button {
  display: -webkit-box;
  display: flex;
  overflow: hidden;
  margin: 10px;
  padding: 12px 12px;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  -webkit-transition: all 150ms linear;
  transition: all 150ms linear;
  text-align: center;
  white-space: nowrap;
  text-decoration: none !important;
  text-transform: none;
  text-transform: capitalize;
  color: #fff;
  border: 0 none;
  border-radius: var(--borderRadius);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-flex: 0;
          flex: 0 0 160px;
  box-shadow: 2px 5px 10px var(--color-smoke);
}
.button:hover {
  -webkit-transition: all 150ms linear;
  transition: all 150ms linear;
  opacity: .85;
}
.button:active {
  -webkit-transition: all 150ms linear;
  transition: all 150ms linear;
  opacity: .75;
}
.button:focus {
  outline: 1px dotted #959595;
  outline-offset: -4px;
}

.button.-regular {
  color: #202129;
  background-color: #f2f2f2;
}
.button.-regular:hover {
  color: #202129;
  background-color: #e1e2e2;
  opacity: 1;
}
.button.-regular:active {
  background-color: #d5d6d6;
  opacity: 1;
}

.button.-dark {
  color: var(--color-snow);
  background: var(--color-dark);
}
.button.-dark:focus {
  outline: 1px dotted white;
  outline-offset: -4px;
}

.button.-green {
  color: var(--color-snow);
  background: var(--color-grass);
}

.button.-blue {
  color: var(--color-snow);
  background: var(--color-ocean);
}

.button.-salmon {
  color: var(--color-snow);
  background: var(--color-salmon);
}

.button.-sun {
  color: #f15c5c;
  background: var(--color-sun);
}

.button.-alge {
  color: #e7ff20;
  background: var(--color-alge);
}

.button.-flower {
  color: #FE8CDF;
  background: var(--color-flower);
}

</style>

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

how to create a Simple Button Styles

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