Dyes attach to fabrics in different ways depending on their chemical composition. Acidic dyes contain acid groups that attach to nitrogen groups in fabrics like wool, silk and nylon. Direct dyes bond to fabrics through hydrogen bonding and are used on rayon and cotton. Reactive dyes were originally used on wool but later found to work well on cotton, reacting with amine and hydroxyl groups. The color fastness of a dye depends on the fabric it is applied to as well as environmental factors like sunlight, which can cause fading over time. Modern dyes are designed to bond strongly to fabrics to prevent running and fading.