A D Major chord contains the notes D, A, F#. It is built from the major formula 1 - 3 - 5, with D as the root.
Why is D major only played on four strings?
The low E and A strings are left out because they would add notes that muddy the chord's clarity. Playing just the top four strings keeps D major bright and focused, which is why it sits so well in busy strummed arrangements.