Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
Cómo agregar los diferentes estilos al pasar el mouse sobre varios elementos bajo una sola etiqueta <a> usando JavaScript o jQuery o CSS

Este es mi código donde tengo problemas para agregar estilos:

 <div class="panel"> <a href = "link"> <img src="abc.jpg"> <h5>Description text</h5> </a> </div>

Requisito:

  1. Cuando se desplaza sobre la imagen, el color del texto H5 puede cambiar a color azul.
  2. Al pasar el cursor sobre el texto H5, el color del texto puede cambiar a color rojo.

Dé la bienvenida a sus correcciones en JavaScript, jQuery o CSS.

Mi intento es:

 $(".panel a").hover( function() { $("h5").css("color","red"); } ); $(".panel a").hover( function() { $("img").css("color","blue"); } );
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

El estado :hover es la mejor manera de arreglar esto para el hover sobre h5 e img

 h5:hover { color: red; transition: .2s; // makes the color change smootly and not static. } img:hover + h5 { color: blue; transition: .2s; }
about 4 years ago · Juan Pablo Isaza Report

0

tal vez esto es lo que quería lograr, pero le sugiero que si no necesita a para envolver todo el contenido en lugar de solo en h5 para hacer clic, reemplace h5 con a ya que su diseño actual necesita más trabajo para lograr algo simple

 a {text-decoration:none;} h5 {text-decoration:underline;color:black;width:max-content;} h5:hover { color:red; } img:hover + h5 { color:blue; }
 <div class="panel"> <a href = "link"> <img style="height:120px;" src="https://i.ibb.co/hLZrDv0/Hitman-3-artwork.png"> <h5>Description text</h5> </a> </div>

aquí está mi diseño sugerido

 a{color:black;} .panel > * {display:block;width:max-content;} a:hover { color:red; } img:hover + a { color:blue; }
 <div class="panel"> <img style="height:120px;" src="https://i.ibb.co/hLZrDv0/Hitman-3-artwork.png"> <a href = "link">Description text</a> </div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!