Geologically speaking, Hong Kong and Macau are both connected to mainland China in certain areas (e.g. the north of the New Territories). Additionally, the islands contained within Hong Kong (e.g. Hong Kong Island) and Macau are much closer to mainland China than Taiwan and Hainan, and are much smaller.
