42. Exercise 12 (Ambitious)

Exercise 12

Pretty much everyone outside North America is going to find these recipes confusing. Tablespoons of butter? Cups of flour? What is wrong with these Americans?

Write a stylesheet that adds a “conversion” menu next to the servings menu. Allow the user to select either “Imperial” or “Metric” units.

Here’s a handy guide to conversions between imperial and metric units:

ImperialMetric
1 tsp6ml (roughly)
1 Tbs15ml
1 cup284ml
1 lb0.454kg
1 oz28.35g
1 qt1.137ℓ
1 in2.54cm

To convert from °F to °C, subtract 32 and then multiply by 5/9.