I am assuming that the WiFi is turned on, on your phone. OK. If it says offline, are you sure that the WiFi is working? Not on your phone but the actual WiFi router or Modem. Are others able to connect to it?
If it is working, for sure, then I would try the following.
Go into your WiFi settings on the phone... "Settings", then tap the word "WiFi" - not the on/off.
Next tap the "three little dots/menu" and then "Advanced".
A few settings in here, if not done correctly, can cause problems.
Now make sure "Network notification" is checked. If it isn't, you will never know if you have an available network.
Be sure that "WiFi auto on" --- isn't --- checked. Why? I have seen more people have issues on phones and other devices due to...