Duh! With its eyes closed, of course! Take a look at these cute photos of baby giraffes sleeping, using their own bodies as pillows for their heads, courtesy of their loooong necks (except the last one, whose head I think plopped to the ground in the sleep).

Next question: Do they wake up with a giant crick in their necks? (Images: Imgur - via Lost at E Minor)