This is a very useful snippet for ensuring that your element height (div, img etc) is always the same as the width. An example case could be a circular div that you want to ensure maintains a set aspect ratio so that it is not squashed or elongated.
There are a few examples of how to achieve this below, but we find the first the cleanest & most consistent.
To use the code make sure that the element has a set width value and that the element also has the appropriate class e.g. '.width-height'.