DEV Community

loading...

Discussion on: Percentages in CSS: you're using them wrong

Collapse
jcpuxd profile image
John Park

I'm having a hard time understanding the type of background image this would be beneficial for... Do you have an example? I've used percentage for lifestyle shots where I want to position subjects into the element bounds in a specific way. The percentages are unique to that image, would this still apply?

Collapse
maxart2501 profile image
Massimo Artizzu Author

Yes, of course that would. Any time you don't know the size of a box, but you want something placed in the "same position", is a good fix for percentage positioning.

In my case, that was simpler. In the left half of the page we had the content; in the right, the disegner decided to have some padding from the boundaries, so there you go.