I've also heard about bitcoin wallets offline, but I don't really understand how it works, and I've heard that offline bitcoin wallets are very safe.
Yes, indeed they are! You won't find any safer wallet than these offline wallets. The reason lies behind this simple fact:
Online wallets, most of the time, store your private keys. These private keys are actually stored on an online server (which you can imagine how safe it'll be).
The thing with offline wallets is that they store your private keys and don't require to be connected to the internet all the time (for hardware wallets). (For paper wallets, it'll never be connected as it's literally a piece of paper).
As most of the hacks and malware and viruses are transferred over the internet, you won't have to worry about them infecting your offline wallets.