1
I am studying HTML5 and CSS3 through an EAD course. I made a screen with social networking buttons with effect by hovering over (just training). The button goes up and below appears the name of the social network I used with ::before
.
In the background there is a DIV with background-image: linear-gradient
. I would like to know how to change the bottom of that gradient in the hover
button? Example, on the Reddit button, the gray part of the gradient is replaced by the orange part of the logo and returns to gray when removing the mouse.
My HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="untitled.css">
<script src="https://kit.fontawesome.com/c8cb246294.js"></script>
</head>
<body>
<div id="fundo">
<nav class="menu">
<button type="button" class="btn_social btn_facebook"><span class="fab fa-facebook-f"></span></button>
<button type="button" class="btn_social btn_instagram"><span class="fab fa-instagram"></span></button>
<button type="button" class="btn_social btn_reddit"><span class="fab fa-reddit-alien"></span></button>
<button type="button" class="btn_social btn_snapchat"><span class="fab fa-snapchat-ghost"></span></button>
<button type="button" class="btn_social btn_twitter"><span class="fab fa-twitter"></span></button>
<button type="button" class="btn_social btn_whatsapp"><span class="fab fa-whatsapp"></span></button>
<button type="button" class="btn_social btn_youtube"><span class="fab fa-youtube"></span></button>
</nav>
</div>
</body>
</html>
My CSS from DIV:
#fundo {
position: absolute;
top: 0;
width: 100%;
height: 100%;
background-image: linear-gradient(to bottom, #ffffff, #808080);
}
My CSS of buttons:
.btn_social {
width: 80px;
height: 80px;
border: none;
color: #ffffff;
background: #aab8c2;
margin: 10px;
font-size: 24px;
border-radius: 10px;
position: relative;
box-sizing: border-box;
cursor: pointer;
transition: all 0.4s ease;
}
.btn_facebook::before {
font-family: arial;
font-size: 1px;
font-weight: bold;
color: #3c5a99;
content: "";
position: absolute;
bottom: -18px;
width: 100%;
left: 0px;
transition: all 0.4s ease;
}
.btn_facebook:hover {
transform: translateY(-20px);
background: #3c5a99;
transition: all 0.5s ease;
}
.btn_facebook:hover::before {
content: "FACEBOOK";
font-size: 14px;
transition: all 0.5s ease;
transition-delay: 0.2s;
}
How to change the gradient background of DIV
along?
My example can be seen in: http://leandrodr.5gbfree.com/ava/untitled.html
Thanks Assis for the tip. Jquery is on the course grid, but it’s a bit distant. As I saw that you can do cool things only with CSS, I thought I could do it.
– Leandro Rodrigues
Assisi, I tried to reproduce your example and it didn’t work here. To work the css and script need to be within the HTML code or can you sort, like a . html, a . css and a . js? Can you help me?
– Leandro Rodrigues