how to make a download button for website code example

Example 1: how do i set a pdf to be download link in html

<a href="./directory/yourfile.pdf" download="newfilename">Download the pdf</a>

Example 2: button download css

<style>
.buttonYN {
  margin: 10em auto 0;
  display: inline-block;
  font-size: 1.15em;
  position: relative;
  text-align: center;
  padding: 0.5em 1em;
  background: linear-gradient(45deg, #59adeb, #40c3af);
  color: #fff;
  box-shadow: 0 0.2em 0.2em rgba(0,0,0,0.25);
  border-radius: 0.2em;
  transition: box-shadow 0.2s ease-in-out;
  cursor: pointer;
}
.buttonYN:active {
  background-color: #ccc;
  box-shadow: 0 0 6px rgba(0,121,238,0.6);
  transition: box-shadow 0.1s ease-in-out;
}
.buttonYN:after {
  content: "\0021e7";
  position: absolute;
  top: -0.4em;
  left: 0;
  right: 0;
  display: block;
  transform: rotate(180deg);
  font-size: 5em;
  opacity: 0;
  text-shadow: 0 0 1em #000;
  transition: opacity 0.3s ease-in-out, font-size 0.3s ease-in-out, top 0.3s ease-in-out;
  box-sizing: border-box;
  text-align: center;
  color: #fff;
}
.buttonYN:active:after {
  font-size: 1em;
  opacity: 1;
  transition: none;
  top: 0.3em;
}
.buttonYN:hover {
  box-shadow: 0 0.1em 0.25em rgba(0,0,0,0.25);
}
</style>

<div style='margin: 0; padding: 0; text-align: center; font-family: sans-serif;'>
  <div class="buttonYN">Download</div>
  </div>

Example 3: how to add stylish download buttom

/* CSS Button Style 2 by indzign.blogspot.com */
.button2{float:left;list-style:none;text-align:center;width:95%;margin:10px;padding:2px;font-size:14px;clear:both}
.button2 ul{margin:0;padding:0}
.button2 li{display:inline;margin:5px;padding:0;list-style:none}
.button2 li a.demo,.button2 li a.download{position:relative;padding:14px 48px 14px 16px;background:#f39c12;display:block;color:#fff!important;font-weight:700;font-size:14px;text-align:left;text-transform:uppercase;letter-spacing:.2px;border-radius:3px;box-shadow:0 1px rgba(0,0,0,0.1);line-height:normal;transition:all .3s;max-width:170px;margin:auto;overflow:hidden}
.button2 li a.download{background:#3498db}
.button2 li a.demo:hover,.button2 li a.download:hover{background:#666}
.button2 li a.demo:active,.button2 li a.download:active{cursor:pointer}
.button2 li a.demo:after,.button2 li a.download:after{content:'\F054';background:rgba(0,0,0,0.1);position:absolute;right:0;top:0;font-weight:normal;display:inline-block;margin:0 0 0 10px;color:#fff;padding:16px 24px;font-family:fontawesome;transition:all .3s}
.button2 li:hover a.demo:after,.button2 li:hover a.download:after{background:transparent;-webkit-animation:bounceright .3s alternate ease infinite;animation:bounceright .3s alternate ease infinite}
@-webkit-keyframes bounceright{from{-webkit-transform:translateX(0)}to{-webkit-transform:translateX(3px)}}
@keyframes bounceright{from{transform:translateX(0)}to{transform:translateX(3px)}}

Tags:

Misc Example