Since the liter measures exactly the same as a decimeter cubed, it also equals a thousand centimeter cubes.
1 L = 1000 cm3
So breaking up the liter into a thousand equal pieces produces milliliters.
1000 mL = 1000 cm3
So, 1 mL = 1 cm3
You may be wondering how the grams got involved in all this. Well, ...
A liter of water, at 4° Celsius, weighs one kilogram.
So, 1 cm3 of water weighs 1 gram.
So, 1 liter of water weighs 1 kilogram and fills 1 dm3.
and that's a triangle if ever I've seen one.