It's slightly more nuanced. Attacking people for protected characteristics such as race, religion, disability, gender, sexuality, is also an offence.
You can be a cunt all you want, just make sure you're being nasty about them as a person not their religion or race or whatever group you might feel they belong to
All cases I've seen have been cut and dry in this regard. Racist or homophobic usually.
Indeed, I didn't mean to imply those three were the only categories of things within "online posts"! Rather, that it's disingenous to lump all of that under one umbrella and suggest great swathes of people are being arrested for a tweet.