The dinosaurs were a group of archosaurian reptiles that dominated the land for 160 million years, from the late Triassic period (230 million years ago) to the end of the Cretaceous period (65 million years ago), when they were wiped out by a meteor. The one line of dinosaurs that survived gave rise to modern day birds. The first dinosaur evolved about 21 million years after the Permian-Triassic extinction, which wiped out the majority of all life. They were part of the first major wave of biodiversity that followed this catastrophic event.
Dinosaurs are members of the superorder Dinosauria, which also includes birds. Their closest relatives are the pterosaurs, flying reptiles sometimes incorrectly called dinosaurs. Pterosaurs and dinosaurs are part of an unranked clade of archosaurs called Ornithodira. The only surviving archosaurs besides birds are Order Crocodilia, which includes crocodiles, alligators, gharials, and caimans.
Officially, dinosaurs are usually defined as all descendants of the common ancestor of the dinosaur Triceratops and modern birds. This common ancestor lived in the late Triassic Period., so the dinosaurs encompass a huge group. Triceratops and modern birds were chosen because they are somewhat distantly related, so the descendants of their common ancestor are numerous and encompass all dinosaurs.
The definition based on morphology rather than phylogeny is "terrestrial archosaurian reptiles with limbs held erect beneath the body". If crocodiles evolved to walk with erect limbs beneath the body, they'd fit this definition.
Dinosaurs are divided into two big groups depending on their hip structure: saurischids and ornithischids. These mean "lizard-hipped" and "bird-hipped." The lizard-hipped dinosaurs include theropods, (mostly bipedal carnivores, including Tyrannosaurus rex, and sauropodomorphs (large, long-necked quadrupedal plant-eaters). The bird-hipped dinosaurs included many diverse herbivores, including hadrosaurids ("duckbilled dinosaurs"), pachycephalosaurians ("bone-heads"), ankylosaurians (armored dinosaurs with club-like tails), stegosaurians (armored dinosaurs with spiked tails), ceratopsians (Triceratops and relatives), and various generic-looking types.
Dinosaurs ranged in size from the size of a chicken (Compsognathus) to the largest sauropods, which were 30 – 45 meters (100 – 148 ft) in length, and 60,000 – 100,000 kilograms (60 - 100 tonnes) in weight, if not more. The largest dinosaur ever discovered, Amphicoelias fragillimus, may have reached 60 m (200 ft) in length, about as long as a 20-story building, although it is only based on descriptions of a femur and vertebrae that have since crumbled to dust. Bruhathkayosaurus, another sauropod, may have weighed 220 tonnes, more than a blue whale, although there is controversy over the estimate.