I drove 1800 miles in a Hydrogen Car

Interesting but how is the hydrogen produced? Web says 95% of all hydrogen is produced from fossil fuels rest from electrolysis. Is electrolysis of water to hydrogen better than putting the electic in batteries?