I am facing a problem where I am trying to display a circular div using CSS, but it only works if the background image property is set first.
Typically, this wouldn't be an issue if the image wasn't being dynamically inserted using PHP code.
I have created 3 jsfiddles to showcase my issue:
https://jsfiddle.net/2wr2wajw/
No problem when setting background first
https://jsfiddle.net/zvq3r0pd/
Problem: background does not resize properly
Link to third jsfiddle: jsfiddle.net/x8g05uph/
Encountering the same issue as above. Expected style code to execute first.
So, what could be causing this issue and how can it be resolved? Thank you.
EDIT
I discovered that adding extra styles in the HTML code resolves the issue, but it's not ideal as it requires rewriting CSS for each tag unnecessarily.
Isn't that what class selectors are for?
Link to fourth jsfiddle: jsfiddle.net/q7sdwbfk/
Not an elegant solution