Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
mikewhy
on Jan 26, 2018
|
parent
|
context
|
favorite
| on:
Mozilla Is Hiring a Developer to Work on Thunderbi...
Wouldn't it be setting both "max-width" and "max-height" to 100%? Or the background-image / background-size hack.
flomo
on Jan 26, 2018
[–]
Believe this is what people are looking for:
https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
tzahola
on Jan 26, 2018
|
parent
|
next
[–]
Nope. This determines how the image is rendered within the img element. The img element itself won’t be constrained in its aspect ratio. E.g. try adding a border or drop-shadow to the img and you’ll see the problem.
bzbarsky
on Jan 26, 2018
|
parent
|
prev
[–]
This works if you set "width: 100%; height: 100%", yes (and "object-fit: contain").
tzahola
on Jan 26, 2018
|
root
|
parent
[–]
Nope. See my comment above.
Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: