The Law of Definite Proportions states that a chemical compound always contains exactly the same proportion of elements by mass. This law stems from the chemical nature of compounds, where there is always a fixed ratio of atoms, each bonded in a well-defined manner in three dimensional space.
For example, carbon dioxide with the chemical formula CO2 has the molecular weight of 44 g/mole. The carbon atom weighs 12 g/mole, while the two oxygen atoms weigh 32 g/mole. Thus, according to the Law of Definite Proportions, carbon makes up about 3/11 of the mass of any sample of CO2, while oxygen makes up the remaining 8/11 of the mass.
These proportions can be determined by dividing the atomic weight of each element, by the total molecular weight.
So for the element carbon in CO2:
(12 g/mole) / (44 g/mole) = 3/11
For the element oxygen in CO2:
(2x 16 g/mole) / (44 g/mole) = 8/11