Adding different animations to a single button based on event in CSS

I added this animation below to a button which triggers whenever the page loads.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> .shadow-pop-br {
animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both;
}
@keyframes shadow-pop-br {
0% {
box-shadow: 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e;
transform: translateX(0) translateY(0) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
}
100% {
box-shadow: 1px 1px #3e3e3e, 2px 2px #3e3e3e, 3px 3px #3e3e3e, 4px 4px #3e3e3e, 5px 5px #3e3e3e, 6px 6px #3e3e3e, 7px 7px #3e3e3e, 8px 8px #3e3e3e;
transform: translateX(-8px) translateY(-8px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
}
}
</code>
<code> .shadow-pop-br { animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both; } @keyframes shadow-pop-br { 0% { box-shadow: 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e; transform: translateX(0) translateY(0) rotateZ(5deg) rotateX(10deg) rotateY(-15deg); } 100% { box-shadow: 1px 1px #3e3e3e, 2px 2px #3e3e3e, 3px 3px #3e3e3e, 4px 4px #3e3e3e, 5px 5px #3e3e3e, 6px 6px #3e3e3e, 7px 7px #3e3e3e, 8px 8px #3e3e3e; transform: translateX(-8px) translateY(-8px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg); } } </code>
  .shadow-pop-br {
    animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both;
}

 @keyframes shadow-pop-br {
    0% {
      box-shadow: 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e;
      transform: translateX(0) translateY(0) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
    }
    100% {
      box-shadow: 1px 1px #3e3e3e, 2px 2px #3e3e3e, 3px 3px #3e3e3e, 4px 4px #3e3e3e, 5px 5px #3e3e3e, 6px 6px #3e3e3e, 7px 7px #3e3e3e, 8px 8px #3e3e3e;
      transform: translateX(-8px) translateY(-8px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
    }
  }

The buttons looks like the attached image button

My button class looks like this:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>.button2 {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border: 3px solid #000000;
border-radius: 0px;
padding: 0;
text-decoration: none;
color: #000000;
position: relative;
overflow: hidden;
transform: rotateZ(5deg) rotateX(10deg) rotateY(-15deg); /* 3D tilt effect */
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Smooth transitions */
height: 130px; /* Height of the button */
width: 130px; /* Width of the button */
cursor: pointer;
animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both; /* Animation on load */
}
</code>
<code>.button2 { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 3px solid #000000; border-radius: 0px; padding: 0; text-decoration: none; color: #000000; position: relative; overflow: hidden; transform: rotateZ(5deg) rotateX(10deg) rotateY(-15deg); /* 3D tilt effect */ transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Smooth transitions */ height: 130px; /* Height of the button */ width: 130px; /* Width of the button */ cursor: pointer; animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both; /* Animation on load */ } </code>
.button2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid #000000;
    border-radius: 0px;
    padding: 0;
    text-decoration: none;
    color: #000000;
    position: relative;
    overflow: hidden;
    transform: rotateZ(5deg) rotateX(10deg) rotateY(-15deg); /* 3D tilt effect */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Smooth transitions */
    height: 130px; /* Height of the button */
    width: 130px; /* Width of the button */
    cursor: pointer;
    animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both; /* Animation on load */
  }

I was trying to add an animation of the button popping up even more on hover and another one where it gets pressed down on mouse click, im trying to translate the button using

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> .button2:active {
transform: translate(2px, 2px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
}
</code>
<code> .button2:active { transform: translate(2px, 2px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg); } </code>
 .button2:active {
    transform: translate(2px, 2px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
}

but nothing seems to work.
How do I implement an animation of the button popping outwards when I hover over it and also the button gets pressed downwards when i click or hold click on it?

New contributor

Aariz Khan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Adding different animations to a single button based on event in CSS

I added this animation below to a button which triggers whenever the page loads.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> .shadow-pop-br {
animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both;
}
@keyframes shadow-pop-br {
0% {
box-shadow: 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e;
transform: translateX(0) translateY(0) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
}
100% {
box-shadow: 1px 1px #3e3e3e, 2px 2px #3e3e3e, 3px 3px #3e3e3e, 4px 4px #3e3e3e, 5px 5px #3e3e3e, 6px 6px #3e3e3e, 7px 7px #3e3e3e, 8px 8px #3e3e3e;
transform: translateX(-8px) translateY(-8px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
}
}
</code>
<code> .shadow-pop-br { animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both; } @keyframes shadow-pop-br { 0% { box-shadow: 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e; transform: translateX(0) translateY(0) rotateZ(5deg) rotateX(10deg) rotateY(-15deg); } 100% { box-shadow: 1px 1px #3e3e3e, 2px 2px #3e3e3e, 3px 3px #3e3e3e, 4px 4px #3e3e3e, 5px 5px #3e3e3e, 6px 6px #3e3e3e, 7px 7px #3e3e3e, 8px 8px #3e3e3e; transform: translateX(-8px) translateY(-8px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg); } } </code>
  .shadow-pop-br {
    animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both;
}

 @keyframes shadow-pop-br {
    0% {
      box-shadow: 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e, 0 0 #3e3e3e;
      transform: translateX(0) translateY(0) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
    }
    100% {
      box-shadow: 1px 1px #3e3e3e, 2px 2px #3e3e3e, 3px 3px #3e3e3e, 4px 4px #3e3e3e, 5px 5px #3e3e3e, 6px 6px #3e3e3e, 7px 7px #3e3e3e, 8px 8px #3e3e3e;
      transform: translateX(-8px) translateY(-8px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
    }
  }

The buttons looks like the attached image button

My button class looks like this:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>.button2 {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border: 3px solid #000000;
border-radius: 0px;
padding: 0;
text-decoration: none;
color: #000000;
position: relative;
overflow: hidden;
transform: rotateZ(5deg) rotateX(10deg) rotateY(-15deg); /* 3D tilt effect */
transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Smooth transitions */
height: 130px; /* Height of the button */
width: 130px; /* Width of the button */
cursor: pointer;
animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both; /* Animation on load */
}
</code>
<code>.button2 { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 3px solid #000000; border-radius: 0px; padding: 0; text-decoration: none; color: #000000; position: relative; overflow: hidden; transform: rotateZ(5deg) rotateX(10deg) rotateY(-15deg); /* 3D tilt effect */ transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Smooth transitions */ height: 130px; /* Height of the button */ width: 130px; /* Width of the button */ cursor: pointer; animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both; /* Animation on load */ } </code>
.button2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid #000000;
    border-radius: 0px;
    padding: 0;
    text-decoration: none;
    color: #000000;
    position: relative;
    overflow: hidden;
    transform: rotateZ(5deg) rotateX(10deg) rotateY(-15deg); /* 3D tilt effect */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Smooth transitions */
    height: 130px; /* Height of the button */
    width: 130px; /* Width of the button */
    cursor: pointer;
    animation: shadow-pop-br 300ms cubic-bezier(0.175, 0.885, 0.320, 1.275) both; /* Animation on load */
  }

I was trying to add an animation of the button popping up even more on hover and another one where it gets pressed down on mouse click, im trying to translate the button using

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> .button2:active {
transform: translate(2px, 2px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
}
</code>
<code> .button2:active { transform: translate(2px, 2px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg); } </code>
 .button2:active {
    transform: translate(2px, 2px) rotateZ(5deg) rotateX(10deg) rotateY(-15deg);
}

but nothing seems to work.
How do I implement an animation of the button popping outwards when I hover over it and also the button gets pressed downwards when i click or hold click on it?

New contributor

Aariz Khan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật