Ideally, you should attach floating shelves (or anything else you’re hanging) to a wall stud, because it support the shelves’ weight best. A stud finder—a hand-held device that uses a magnet ...