In guitar playing legato is used interchangeably as a label for both musical articulation and a particular application of technique—playing musical phrases using the left hand to play the notes—using techniques such as hammer-ons and pull-offs instead of picking to sound the notes.
Quickly pressing your finger down and raising the note without hitting the string again is called “hammering on”. Without electric amplification, the hammer-on tends to be quieter than regularly struck notes, especially if you haven’t practiced it.
Place your index finger on the 5th fret of the 4th string and strike it. While the note is still ringing, quickly and firmly press your ring finger down on the 7th fret of the same string without striking it with your picking hand. If done properly, a D note should be sounding.
The pull-off is the opposite of the hammer-on. Using the G string, place your index finger on the 5th fret and at the same time put your ring finger on the 7th fret. Strike the string and while the note is still ringing, release the ring finger. If done properly, the D should be followed by a C. If the note doesn’t ring out properly, try hitting the D harder and releasing faster.
Like the hammer-on, the second note tends to be less loud than the first. To help alleviate this, a slight sideways motion of the fretting finger while pulling off will add extra vibration to the string, and give you some extra volume. Often it is hard for a beginner to accomplish, and the sideways movement helps greatly.