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

334
Views
¿Cómo usar css para hacer div con pocas secciones desbordadas?

https://jsfiddle.net/g0Lf42bq/6/#&togetherjs=khq05DeHEp

Tengo un div que contiene texto + íconos, los íconos son visibles solo cuando paso el mouse sobre este div. Quiero que mientras estoy sobre el div, si el texto es demasiado largo, será elipsis y mostraré todos los íconos.

(el comportamiento deseado es como en la bandeja de entrada de GMAIL cuando se pasa el cursor sobre un mensaje, se muestran los íconos y el texto es puntos suspensivos)

actualmente, el texto no tiene puntos suspensivos y no veo todos los íconos

 .selected-field-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .field-section { display: flex; justify-content: space-between; background: #FFFFFF; border: 1px solid #CCCED3; box-sizing: border-box; border-radius: 2px; font-weight: 400; font-size: 12px; line-height: 14px; color: #37383A; padding: 6px; margin-top: 10px; width: 195px; max-width: 195px; } .remove-field { display: none; } .field-section:hover .remove-field { display: flex; }
 <div class="field-section"> <div class="selected-field items-center"> <div class="selected-field-name">{{selectedField.name}}</div> </div> <div class="d-flex"> <icon-button class="remove-field" Icon="plus" width="16px" height="16px" (click)="removeField(selectedField)"></icon-button> <icon-button class="remove-field" Icon="x-close" width="16px" height="16px" (click)="removeField(selectedField)"></icon-button> </div> </div>

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Simplemente agregue overflow: hidden al .selected-field

 .selected-field{ overflow: hidden; }

Ejemplo de trabajo:

 .selected-field-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .field-section { display: flex; justify-content: space-between; background: #FFFFFF; border: 1px solid #CCCED3; box-sizing: border-box; border-radius: 2px; font-weight: 400; font-size: 12px; line-height: 14px; color: #37383A; padding: 6px; margin-top: 10px; width: 195px; max-width: 195px; } .remove-field { display: none; background: red; color: white; } .field-section:hover .remove-field { display: flex; } .selected-field{ overflow: hidden; } .icon-wrap{ display: flex; white-space: nowrap; gap: 10px }
 <div class="field-section"> <div class="selected-field items-center"> <div class="selected-field-name">hello how are you today?</div> </div> <div class="d-flex icon-wrap"> <div class="remove-field" Icon="plus" width="16px" height="16px" (click)="removeField(selectedField)">Plus icon</div> <div class="remove-field" Icon="x-close" width="16px" height="16px" (click)="removeField(selectedField)">Close icon</div> </div> </div>

over 4 years ago · Santiago Trujillo Report

0

Puede corregir el ancho de la división del texto y truncar el texto. Espero que esta guía resuelva todos sus problemas.

over 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!