Search code examples
htmlcsshidden

Text disappears on hover CSS


My text disappears when I hover over it. I tried removing the hidden and putting the visibility: visible and I changed the opacity to 1 but I still keep getting the same - the text still disappears when I hover. I am trying to make the text stay the same and do nothing when I hover. The weird thing is I have a box border around it and when I hover the whole lower part disappears with it so half the box and the text disappear too. Am I missing something else?

HTML 
<div class="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-6 ">
   <div class="ps">
       <div class="thumbnail">
           <a href=" "><img src="http://placekitten.com/100/100" alt=" "></a>
            <div class="badge">10%</div>
                  </div>
 <div class="container">
         <a class="v" href="/Animal/Cat">Cat store</a>
 <div class="content">
  <a class="title" href="cat_new">kITTY</a>


 
 </div>
 </div>
  </div>
 </div>

CSS

.title {
    margin: 0;
    display: block;
    padding: 0 0 5px;
    font-size: 14px;
    line-height: 1.2em;
    color: #06c;
    --max-lines: 2;
    max-height: calc(1.2em * var(--max-lines));
    overflow: hidden;
    padding-right: 1rem;
    opacity: 1;}
    
    
    a {
    position: relative;
    color: inherit;
    text-decoration: none;
    transition: all 0.4s ease; }
    
.hover .content {
  visibility: hidden;
  opacity: 1;
  height: 0;
}

.hover {
  border-color: silver;
}

.ps-product--inner .content {
  display: block;
  visibility: visible;
  opacity: 1;
}

Solution

  • please remove the visibility: hidden in "ps-product:hover .ps-product__content" .

     .ps-product__title {
        margin: 0;
        display: block;
        padding: 0 0 5px;
        font-size: 14px;
        line-height: 1.2em;
        color: #06c;
        --max-lines: 2;
        max-height: calc(1.2em * var(--max-lines));
        overflow: hidden;
        padding-right: 1rem;
        opacity: 1;}
        
        
        a {
        position: relative;
        color: inherit;
        text-decoration: none;
        transition: all 0.4s ease; 
     }
        
    .ps-product:hover .ps-product__content {
     /*     remove  visibility: hidden;   */
      opacity: 1;
      height: 0;
    }
    
    .ps-product:hover {
      border-color: silver;
    }
    
    .ps-product:hover.ps-product--inner .ps-product__content {
      display: block;
      visibility: visible;
      opacity: 1;
    }