A rack includes a plurality of upright support rods, horizontal support rods fastened between the upright support rods, slide rails fastened between the horizontal support rods, and shelves slidably mounted on the slide rails. The slide rails are adjustable in length and formed of a main body, a movable member, and an elastic element. The main body has a hollow end. The movable member has a hollow interior with an open end and a closed end. The movable member is movably fitted over the hollow end of the main body. The elastic element is located in the hollow interior of the movable member and the hollow end of the main body such that one end of the elastic element is retained by the closed end of the movable member, and such that the other end of the elastic element is retained in the hollow end of the main body.