1

Is it possible to make the percentage in margin-left a percentage of the image size instead of the containing element? Here's an example.

Reactormonk
  • 21,472
  • 14
  • 74
  • 123

1 Answers1

2

A similar question has been asked in this link: Value calculation for CSS

To my knowledge, as well, CSS is not a language with the ability of complex interoperability between selectors or between property values of selectors.

So the best way you can choose might be using JavaScript or a JavaScript library such as jQuery, in order to find out what exactly a certain percentage of a certain property value corresponds to. Then you can dynamically assign that corresponding value to the property you intended to, using JS/jQuery of course.

Community
  • 1
  • 1