The largest animals ever to roam the Earth were sauropod dinosaurs in the Jurassic and Cretaceous eras. They did not eat meat. Despite having to constantly eat grass and leaves the heaviest reached 50 tonnes.
The periods going back from the present are Cenozoic, Cretaceous, Jurassic, Triassic and Paleozoic. The last four are grouped into the Mesozoic era. It is in this general broad time frame that the gigantic dinosaur arose and died off.
Though for the most part these creatures walked with their heads in an horizontal position, for feeding it is presumed that they reached up vertically to feed on young branches and leaves high in the trees. Other herbivores could not reached up to this rich food source. Mammals had not yet risen. Giraffes appeared much later.
Having plenty of food meant the sauropods could evolve and become very large. Their bones were light and with a small head the neck became long. They swallowed food whole so they had tiny jaw muscles. Food remained in the body a long time. This enabled thorough digestion of leaves and even some wood. Not masticating in itself left more energy to grow bigger.
They were bird-like, having an efficient respiratory system; thus the significant body heat was dissipated. The high basal metabolic rate meant they could live longer and survive to become adults and reproduce. Having many young from eggs maintains a species more effectively than the mammalian way of breeding.