0

I'd like text to appear on the right side of a logo when the person moves the cursor over the logo. I checked out other similar questions and tried their solutions and it still doesn't work. When I hover over the logo, nothing appears. When I check the inspector, the browser doesn't seem to read the hover effect. Its still reading opacity:0 and visibility:hidden.

.logo {
  display: block;
  width: 90px;
}

.puneet-name {
  position: absolute;
  visibility: hidden;
  opacity: 0;
  transition: opacity .2s, visibility .2s;
}

.logo img:hover .puneet-name {
  visibility: visible;
  opacity: 1;
}

.header_menu {
  padding: 25px 0;
  z-index: 12;
  margin-right: 2px;
  margin-left: 0.1px;
}
<div class="header_menu row d-flex align-items-center justify-content-between">
  <a class="logo" href="#">
    <img src="images/PS_logo.png" alt="logo"/>
  </a>
  <div class="hover-text lineHeading">Person Name</div>
</div>
Philip
  • 3,486
  • 1
  • 24
  • 37
Devika Sujith
  • 111
  • 13

1 Answers1

0

Text will show when hovering over the image

.container {
  position: relative;
  width: 50%;
}

.image {
  display: block;
  width: 100%;
  height: auto;
}

.hover-text {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
  opacity: 0;
  transition: .5s ease;
  background-color: #008CBA;
}

.container:hover .hover-text {
  opacity: 1;
}
 

<div class="container">
  <a class="logo" href="#">
         <img src="images/PS_logo.png" alt="logo" class="image"/>
      </a>
  <div class="hover-text">
    <div class="text">Person Name</div>
  </div>
</div>
nourza
  • 2,215
  • 2
  • 16
  • 42