Ask A Question


You’re not receiving notifications from this thread.

Possible to get img elements to be the size of container and behave like background-image?

DomnikBritto asked in General

I’m using a grid for a complex layout and I would like the images in it to have no control over size. The grid is set using fr unit s so that it too will not have an actual height, but instead just fill the space of its container.

I’ve set the images to 100% which fills the cells, but their ac mobdro tual pixel dimensions still have control over the the grid. I would expect the grid to collapse completely when there’s nothing in it that has an explicit height, but this is not what happens. The images intrinsic size still exerts some control.

It does work when I set images using background but that’s semantically incorrect for my use case.

Is this possible?

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.