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

160
Views
¿Cómo superponer elementos?

¿Cómo puedo superponer un div con una imagen? Tengo un div que contiene una imagen y otro div, donde el div tiene una opacidad de 0 por defecto y una opacidad de 1 cuando se desplaza. La cosa es que tengo mi imagen y debajo del div oculto. Quiero que mi div aparezca en el centro de mi imagen cuando pase el mouse por encima y no por debajo.

Este es mi Post.js:

 const Post = () => { return ( <div> <div className="postContainer"> <img src={image} alt="profile"/> <div className="overlay"> <div className="content"> <FontAwesomeIcon icon={faHeart} /> </div> </div> </div> </div> ) } export default Post

Y este es mi Post.css

 .postContainer{ height:300px; width:300px; box-shadow: 0px 0px 2px 1.5px rgba(0, 0, 0, 0.2); margin:10px; } .postContainer:hover{ opacity:.5; } .postContainer img{ /* max-width: 100%; max-height: 100%; */ height:300px; width:300px; } .overlay{ opacity: 0; } .postContainer:hover .overlay{ opacity:1; }
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Sugeriría usar la cuadrícula CSS para esto

 .postContainer{ height:300px; width:300px; box-shadow: 0px 0px 2px 1.5px rgba(0, 0, 0, 0.2); margin:10px; display: grid; place-items: center; } .postContainer > * { grid-area: 1/1/-1/-1 } .postContainer img{ height: 100%; width: 100%; object-fit: cover; } .postContainer .overlay{ opacity: 0; z-index: 1; } .postContainer:hover img { opacity: .5} .postContainer:hover .overlay{ opacity: 1 }
about 4 years ago · Santiago Trujillo 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!