<Image /> component nightmare...
Answered
Pacific anchoveta posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Pacific anchovetaOP
Hi, everybody.
I have a hard time getting the
I want to restrict the heigh of an image to 40px, as I'm using it in a table row. Also, I need it to be
I tried to wrap the
Could anyone give me a hint?
I have a hard time getting the
Image
component working as intended. I want to restrict the heigh of an image to 40px, as I'm using it in a table row. Also, I need it to be
object-fit: cover
as I don't want it to be "skewed". I tried to wrap the
Image
in a div with height: 40px
, and then set fill
and then style: {{object-fit: cover}}
, but it does not work. Could anyone give me a hint?
Answered by Pacific anchoveta
Problem solved by adding
relative
+ height to the parent div.![Image](https://cdn.discordapp.com/attachments/1165974701521244190/1166283562111225947/Screenshot_2023-10-24_at_09.53.41.png?ex=6549ed35&is=65377835&hm=f46964d3e34b5f0bfd93b4b9a244d96550ca9b18e94e979f15ec259d7a8acc5e&)
4 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Giant panda
please share the code snippet
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Pacific anchovetaOP
![Image](https://cdn.discordapp.com/attachments/1165974701521244190/1166275271599587338/Screenshot_2023-10-24_at_09.21.02.png?ex=6549e57d&is=6537707d&hm=5594a8861005debb79a7e63808fa3649ea23a1da294627b8e59f1560739bd4e9&)
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
Cape horse mackerel
Have you tried to add
height={40}
to the Image
?![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Pacific anchovetaOP
Problem solved by adding
relative
+ height to the parent div.![Image](https://cdn.discordapp.com/attachments/1165974701521244190/1166283562111225947/Screenshot_2023-10-24_at_09.53.41.png?ex=6549ed35&is=65377835&hm=f46964d3e34b5f0bfd93b4b9a244d96550ca9b18e94e979f15ec259d7a8acc5e&)
Answer