You can use percent instead. So the length of the green health bar is 100% when its full and if you get hit you subtract the amount from the health bar in percent.
So if your HP is set to 100 and you get hit by an enemy causing -10HP you subtract 10% of the length of the bar.
And when you're high level and your HP is set to maybe 1000 and you get hit by the same enemy causing -10HP you only subtract 1% of the healthbars length.