A fastener includes a connecting pole, a sleeve, an elastic element enclosing the sleeve and a baffling portion. The connecting pole includes a shaft, a head and a thread portion. The sleeve includes an engaging portion and a receiving portion extending from the engaging portion. The engaging portion encloses a top end of the shaft therein and abuts against the head. The receiving portion encloses a bottom end of the shaft and a top end of the thread portion. The receiving portion includes a plurality of spaced resilient pieces. The baffling portion screws onto the thread portion of the connecting pole. When the connecting pole rotates relative to the sleeve, the baffling portion moves upwardly along the thread portion to push the pieces of the receiving portion outwardly to make the pieces abut against a bottom surface of a printed circuit board.