0

I'm stucked at a css problem, and i used to struggle a lot of times with thoses.

I want to make a minicard for a document like this :

enter image description here

And i want the file name not overflow if the title is too long and make text-ellipsis on it nut its not working, here is my simple html markup:

.document {
  display: flex;
}

figure {
  height: 64px;
  width: 64px;
}

.infos {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

strong {
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
<a href="My document with a very very very long text.pdf" class="document">
  <figure>
    <img src="/uploads/miniatures/Screenshot%202023-08-24%20125622.png" alt="My document with a very very very long text.pdf">
  </figure>
  <div class="infos">
    <strong>My document with a very very very long text.pdf</strong>
    <span>Now, 512.2 KB</span>
  </div>
</a>

I've looked a lot of topics on this, talking about min-width, use of flex-basis and other thing.

but the main problem looks like i'm using a v flex inside a h flexbox and all the examples i saw have not a flexbox nested.

Do you have any clue?

Thank a lot in advance.

Mark Schultheiss
  • 32,614
  • 12
  • 69
  • 100
Leoche
  • 11
  • 2
  • min-width:0 to .infos – Temani Afif Aug 24 '23 at 13:21
  • Ok thank you @TemaniAfif , i tested on a codepen https://codepen.io/Leoche/pen/RwEWbMP and it worked but not in my design, i looked into the parent and it was the grid column that wasn't good the main issue was that that the grid-template-columns: auto;, i changed to grid-template-columns: minmax(0, 1fr); and it worked. Thanks a lot! – Leoche Aug 24 '23 at 13:42

0 Answers0