Homosexuality has been documented in China since ancient times. According to one study by Bret Hinsch, for some time after the fall of the Han dynasty, homosexuality was widely accepted in China but this has been disputed. Several early Chinese emperors are speculated to have had homosexual relationships accompanied by heterosexual ones. Opposition to homosexuality, according to the study by Hinsch, did not become firmly established in China until the 19th and 20th centuries through the Westernization efforts of the late Qing dynasty and early Republic of China. On the other hand, Gulik's study argued that the Mongol Yuan dynasty introduced a more ascetic attitude to sexuality in general.
Anal sex between two males being viewed, Qing Dynasty
Emperor Ai of Han, personal name Liu Xin, was an emperor of China's Han dynasty. He ascended the throne when he was 20, having been made heir by his childless uncle Emperor Cheng, and he reigned from 7 to 1 BC.
Emperor Ai of Han and Dong Xian, by Chen Hongshou (17th century)
Yiling (義陵), the tomb of Emperor Ai, in Xianyang, Shaanxi