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

224
Views
Haga texto en el centro de div y expanda desde el medio si hay mucho texto

Tengo un div que es un cuadro cuadrado y lo quiero en el medio, cuanto más texto le pongas seguirá estando en el medio, estoy haciendo mi cuadro cuadrado con JQuery y me gustaría centrarlo con css. aquí está mi código:

 <div class="project-item" style="background-color:orange;"> <div class="darkShade"> <p>project.TextContent</p> </div> </div>

CSS

 .project-item { width: 33%; background-size: cover; color: #FFF; position: relative; .darkShade { padding: 2em; } p { opacity: 0; transition: 0.2s all; } form { display: flex; flex-direction: column; position:relative; div { display: flex; flex-direction: row; width: 100%; } } } .project-item:hover { p { opacity:1; } }

JQuery

 var cw = $('.project-item').width(); $('.project-item').css({ 'height': cw + 'px' });

https://jsfiddle.net/su3h76am/4/

Gracias de antemano Saludos Max

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

¿Como esto? https://jsfiddle.net/vcts5h8o/

 .project-item { width: 33%; background-size: cover; color: #FFF; position: relative; // display: flex; .darkShade { padding: 2em; // margin: auto; width: max-content; } }
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!