Literary nonsense or nonsense literature is a term referring to a literary genre which includes many elements of the fantastic, nonsensical, whimsical, and irrational. It has two different historical origins. The first is a folk tradition and includes many nursery rhymes, folk tales, and ballads. Some of the nonsensical elements of this tradition derive from elements of ossified religious or ritual tradition which have become garbled or meaningless over time while others reflect elements of fantasy.
A second tradition that contributed to nonsense literature is a more literary one, in which hyperbole and nonsense are related to satire and erudite wit. Carroll himself was a highly educated and intelligent professor of mathematics who synthesized elements of both traditions in his famous children's books.
What makes Through the Looking-Glass nonsense literature rather than fantasy is that many of the nonsensical or absurd elements are not part of a coherent or rational fantasy world but instead are surreal or dreamlike. The novel includes examples of pure gibberish, non-responsive dialogue, and scenes that melt or dissolve from one to another without any apparent logical connection. Traditional riddles, for example, have answer which resolve their apparent nonsensical nature with a rational solution but in this novel riddles may have no answer.