I've this HTML file. I'm trying to implement :hover property so when I pass over .linux-face element the .info element set opacity to 0. I'm trying to get out of this for about 30 minutes. I've also try to map :hover to other class but nothing seems working.
<!DOCTYPE html>
<html>
<head>
<!-- Setup -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@300;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="main.css" />
<title> Linus Torvald aka Linux </title>
</head>
<body id="main">
<section class="main-section">
<div class="container">
<h1 id="title" class="main-title"> Linus Torvald </h1>
<div class="image-section" id="img-div">
<img id ="image" class="linux-face" src="img/linus_torvald.jpg" alt="Linus Torvald smiling face :)">
<p id="img-caption">Linus Torvald smiling face :) </p>
</div>
<div class="info">
<p id="tribute-info"> <span class="linux_info"> Hello, World! </span> </p>
</div>
</div>
</body>
</html>
That's my scss file:
#main {
display: flex;
justify-content: center;
}
.main-title {
font-family: 'Josefin Sans', sans-serif;
}
.linux-face {
&:hover {
.info{
opacity:0;
}
}}
If I try something like
.linux-face:hover {
opacity: 0;
}
the hover effect on .linux-face works fine. Also this work fine
.container:hover {
.info {
opacity: 0;
}
}
question from:https://stackoverflow.com/questions/65841684/css-hover-img-not-work-on-other-class-opacity