42. Exercise 12 (Ambitious)
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:
Imperial | Metric |
---|---|
1 tsp | 6ml (roughly) |
1 Tbs | 15ml |
1 cup | 284ml |
1 lb | 0.454kg |
1 oz | 28.35g |
1 qt | 1.137ℓ |
1 in | 2.54cm |
To convert from °F to °C, subtract 32 and then multiply by 5/9.