N
N
Norum2021-05-31 02:04:04
css
Norum, 2021-05-31 02:04:04

How to make an svg image change color on hover to a gradient?

How to make svg change color to gradient? I managed to achieve a color change using a pseudo-element, but here's how to change it to a gradient... I don't know

<section class="download">
    <div class="wrapper">
      <div class="content">
        <h3>Download Giant App Now</h3>
        <div class="download-blocks">

          <a href="#" class="download-block">
            <div class="img">
              <i class="fab fa-apple foundation"></i>
              <i class="fab fa-apple overlay"></i>
            </div>
            <div class="text">
              <span class="title">Download</span>
              <span class="little">Download from app store</span>
            </div>
          </a>

          <a href="#" class="download-block">
            <div class="img">
              <img src="img/android-logo.png" alt="android">
            </div>
            <div class="text">
              <span class="title">Download</span>
              <span class="little">Download from app store</span>
            </div>
          </a>

          <a href="#" class="download-block">
            <div class="img">
              <i class="fab fa-windows"></i>
            </div>
            <div class="text">
              <span class="title">Download</span>
              <span class="little">Download from app store</span>
            </div>
          </a>
          
        </div>
        
      </div>
    </div>
    
  </section>

.download {
  background: linear-gradient(90deg, #fd712c 0%, #f21780 100%);
  text-align: center;
}
.download h3 {
  font-weight: 400;
  color: #ffff;
  margin-bottom: 80px !important;
}
.download-blocks {
  display: flex;
  justify-content: space-between;
}
.download-block {
  width: calc(33.33333333%);
  margin-right: 30px;
  display: flex;
  background-color: #ffffff;
  box-shadow: 0px 10px 30px 0px rgba(0, 0, 0, 0.07);
  border-radius: 3px;
}
.download-block .img {
  position: relative;
  background-color: #f7fafc;
  padding: 30px;
  border-radius: 3px;
}
.download-block .img img,
.download-block .img i.foundation {
  width: 56px;
  height: 56px;
  font-size: 56px;
  color: #777777;
}
.download-block .img i.overlay {
  position: absolute;
  left: 26%;
  width: 56px;
  height: 56px;
  font-size: 56px;
  color: blue;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.download-block .text {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 30px;
}
.download-block .text .title {
  font-size: 30px;
  font-weight: 600;
  color: #222222;
}
.download-block .text .little {
  color: #777777;
  font-size: 14px;
  font-weight: 300;
}
.download-block:hover i.overlay {
  opacity: 1;
}
.download-block:last-child {
  margin-right: 0 !important;
}


All code https://jsfiddle.net/c47jhmd3/

Website tempesv0.beget.tech

60b4199cbaa34365163216.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lagudal, 2021-05-31
@Norum

similar question
Look, even earlier there were still such questions.
The bottom line is in 2 words - if you need a smooth gradient on hover - then either js, or - a layer on top and change the transparency on hover. (opacity) + transition.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question