Can't get transparent glass in Eevee
Preview and render use different render engines, that's why it looks different.
Just enable refraction in Eevee and both will look right.

Properties &gt; Material &gt; Viewport Display
Check Screen space refraction
Specify Refraction depth (glass thickness)

More thorough answer: My glass material isn't transparent in Eevee