Patagonian
Member
Your probably right but I'm pretty stubborn when it comes to getting things right. I like it to work on the back-end too. Interesting idea with calc though. That's quite interesting. I didn't think about it like that.
The problem with styling on the server is that you can never cater for the unknown needs of the user. Just look at the requests in the last 24 hours for how folks want the bar to be rendered. So, in my mind, I'd always present data to the front end with a view to final style being configured in CSS. And by that I mean positional CSS, not color etc.
Anyways, each to their own.
Meanwhile, I mocked your requirement up on Codepen. Self explanatory I hope and shows how easy it is to show likes as a % of bar width. You need to set --upperBound which controls the % of bar rendered in green. Not tested to any great degree, but just there in case @Xon would consider rendering bar data in this way, at least as an option, allowing folks greater control of how it appears.
https://codepen.io/Patagonian/pen/Pevvzd
With some more thought, this could cater for most requirements I feel.
.