Fossil fuels will eventually be phased out, but I'm willing to bet that won't be for at least 20 more years, probably closer to 50. And that's only for mainstream consumer vehicles.
Hold that thought.
The reason is, any legislation that forces this ends up becoming a regressive tax that punishes rural populations that rely on old, cheap transportation to earn income. There won't be enough used EVs with sufficient range for them to buy - think of that old cell phone you had that only lasted a few hours between charges - for probably 20 years. Furthermore, our electrical grid can't support 260 million plug-in EVs, and won't be able to until we have cheap, plentiful, clean power to generate it. Europe's power infrastructure is in even worse shape. We would need more nuclear reactors in the US than there currently exist in the world to supply enough baseline power to charge those vehicles, even if every home had solar panels on top. Add on top of that the millions of other forms of vehicle transportation such as buses, semis, work trucks, construction vehicles, delivery trucks, etc, which would consume as much as 10 times the electricity an average Bolt might today.
It's simpler than that. There are basically two forms of power generation - base load, and peaking load. Base load is constant, steady power generation that forms the bulk of the power produced. Peaking load is the power that quickly throttles up or down to match the instantaneous spikes and drops in demand - it makes the amount of power generated exactly match the amount of power demanded.
The only non-fossil forms of base load are nuclear and geothermal. The environmental movement has a stick up their *$$ about nuclear (despite it being the safest form of power generation man has invented - yes, safer than wind or solar). And the availability of geothermal is highly dependent on your location.
Wind only works when the wind is blowing. Solar only works when the sun is shining. Neither are constant nor consistent. Hydro could potentially provide base load. But hydro is incredibly good at instantaneously throttling up or down to meet demand, so it's used primarily for peaking load
People are suggesting some form of energy storage like batteries to get around this problem. But that creates a new problem in itself. Currently, the best form of energy storage (pumped storage - you pump water up into a high reservoir, and when you need the energy back you run the water through a turbine like a hydro plant) is only about 70%-80% efficient. Multiply by the approx 90% efficiency of a hydroelectric turbine, and you have an overall efficiency of about 67.5%. In other words, you're taking wind or solar energy, which is already more expensive than fossil fuels, and making them 50% more expensive by trying to use them to supply base load.
And then there's the airlines and shipping. How much battery power will it take for a heavy container ship nearly 1,000 feet long carrying a thousand cars plus other consumer goods to sail from Europe through the Panama Canal to Long Beach? What about from China through the Suez Canal to Europe? Who's willing to trust a plug-in 787 Dreamliner to get them from Los Angeles to Singapore? How long will it take to recharge that electric jet for the return trip?
That's why I don't think electricity stored in batteries is going to be the answer. The energy density (megajoules per kg) simply isn't high enough. Gasoline and diesel are up around 46-48 MJ/kg. Batteries are down around half a MJ/kg. Batteries still have to improve by nearly two orders of magnitude to supplant chemical fuels for weight-sensitive applications like aircraft.
https://en.wikipedia.org/wiki/Energy_density#Energy_densities_of_common_energy_storage_materials
It could happen. There could be a breakthrough in electrochemical technology which makes this feasible in the next couple decades. I suspect however that it won't happen for a century or two. But before that happens, i think it's far more likely we'll figure out a chemical process to break down cellulose (wood). See, cellulose is basically a bunch of sugar molecules glued together to form really long, unwieldy molecules. So long that only a few bacteria have figured out how to decompose it into its constituent sugars (these bacteria are found in the guts of termites and herbivores).
Sugar is energy-rich. Plants create it via photosynthesis - pulling CO2 out of the air and H2O from the ground, and using the energy in sunlight to convert those into sugars. Then gluing the sugars together to form cellulose. If/when we figure out a quick, efficient, and cheap method of breaking down cellulose, the entire game changes. Because once we have sugar, it's a relatively easy process to turn it into alcohol. And you get ethanol fuel. 26 MJ/kg. Not as good as gasoline, but still much better than batteries.
We wouldn't need to build solar panels. Just plant a tree; or better yet, plant weeds or other fast-growing plant matter like kelp or algae. They self-replicate so there's zero manufacturing cost. Then you harvest them (or in the case of weeds, we're already "harvesting" them - we're just sending them to a landfill or compost heap). Break down their cellulose to get sugar, ferment the sugar to create alcohol, and you've got liquid fuel with close to the energy density of fossil fuels, yet is completely renewable.