Animated Border Effect by Using HTML, CSS and JavaScript





 <div class="banner">
  <div class="inner">
    <h1>Pawan Mall</h1>
  </div>
</div>




:root {
  --img: linear-gradient(120deg, rgba(43, 62, 1, 0.82) 0%, rgba(12, 93, 23, 0.69) 100%), url(https://lh3.ggpht.com/p/AF1QipPMMGScLxelev5oVEp34fh8AJerF40vWMaMFuk=s512);
  --br: linear-gradient(to top, #96fbc4 0%, #f9f586 100%);
  --bb: linear-gradient(to top, #37ecba 0%, #72afd3 100%);
  --bl: linear-gradient(to top, #c471f5 0%, #fa71cd 100%);
  --bt: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%);
  --p: 20px;
  --bw: 2px;
  --t: 1s;
  --td: 200ms;
  --te: ease-out;
}

body {
  height: 100vh;
  display: flex;
  background-color: darkslategray;
}

.banner {
  --w: 720px;
  --h: 200px;
  max-width: var(--w);
  width: 100%;
  margin: auto;
  height: var(--h);
  background-image: var(--img);
  background-size: var(--w);
  background-repeat: no-repeat;
  background-position: center;
  transition: background-size var(--t);
  position: relative;
  box-shadow: 0px 30px 30px -20px rgba(0, 0, 0, 0.45);
}
.banner .inner {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}
.banner .inner > h1 {
  position: relative;
  font-family: serif;
  color: white;
  letter-spacing: .4em;
  text-transform: uppercase;
  font-size: 1em;
  transition: var(--td);
}
@media (min-width: 480px) {
  .banner .inner > h1 {
    font-size: 2em;
  }
}
@media (min-width: 768px) {
  .banner .inner > h1 {
    font-size: 3em;
  }
}
.banner .inner::before,
.banner .inner::after, .banner::after, .banner::before {
  content: '';
  position: absolute;
}
.banner::before {
  top: var(--p);
  right: var(--p);
  height: 0;
  width: var(--bw);
  background-image: var(--br);
  transition: height var(--td) var(--te) 0.75s;
}
.banner::after {
  bottom: var(--p);
  right: var(--p);
  width: 0;
  height: var(--bw);
  background-image: var(--bb);
  transition: width var(--td) var(--te) 0.5s;
}
.banner .inner::before {
  bottom: var(--p);
  left: var(--p);
  height: 0;
  width: var(--bw);
  background-image: var(--bl);
  transition: height var(--td) var(--te) 0.25s;
}
.banner .inner::after {
  top: var(--p);
  left: var(--p);
  height: var(--bw);
  width: 0;
  background-image: var(--bt);
  transition: width var(--td) var(--te) 0s;
}
.banner:hover::before {
  height: calc(var(--h) - var(--p) * 2);
  transition: height var(--td) var(--te) 0s;
}
.banner:hover::after {
  width: calc(100% - var(--p) * 2);
  transition: width var(--td) var(--te) 0.25s;
}
.banner:hover .inner::before {
  height: calc(var(--h) - var(--p) * 2);
  transition: height var(--td) var(--te) 0.5s;
}
.banner:hover .inner::after {
  width: calc(100% - var(--p) * 2);
  transition: width var(--td) var(--te) 0.75s;
}
@media (min-width: 768px) {
  .banner:hover {
    background-size: 760px;
  }
}





// NO JavaScript Required.... www.pawanmall.net

1 comment:

Thank you for your comment.

 Image

 Image

About



I'm something poet, marketer, social media consultant, web designer, web developer, web programmer, blogger(hobby) & a good human being. Originally from Gorakhpur, UP and currently living in the New Delhi. ..

Twitter
Facebook

Resume

Curriculum Vitae


Pawan Mall

Web Designer, Developer & Blogger

New Delhi, Delhi, INDIA
mailpawanmall.net
www.pawanmall.net
Pawan Mall - resume photo avatar

Objective

I'm something poet, marketer, social media consultant, web designer, web developer, web programmer, blogger(hobby) & a good human being. Originally from Gorakhpur, UP and currently living in the New Delhi. ..

Skills

  • Front-end
  • HTML/HTML5
  • CSS/CSS3
  • JS/jQuery
  • Bootstrap
  • Back-end
  • PHP/OOP
  • SQL/MySQL
  • Codeigniter Framework
  • cPanel & phpMyAdmin

Education

  • Sikkim Manipal University graduate of 2015.

Experience

  • Web Designer/Developer/Leads Manager ~ 2007-2017

Contact Form

Contact

  • New Delhi, Delhi, India

  • +91 **********

  • mailpawanmall.net

Follow me on :-