دليل تحويل الوحدات: px وrem وem وpt
Quick Answer
1rem = حجم الخط الجذر (16px افتراضياً)، 1em = حجم خط العنصر الأب، 1pt ≈ 1.333px، 1in = 96px. استخدم محول وحدات CSS المجاني للتحويل الفوري في متصفحك.
Introduction
وحدات CSS المطلقة (px وpt وmm وcm) لها قيم ثابتة، بينما النسبية (rem وem) تعتمد على حجم الخط الجذر أو العنصر الأب. 1rem = حجم الخط الجذر (عادة 16px). 1em = حجم خط العنصر الأب. 1pt = 1/72 بوصة ≈ 1.333px.
Step by Step
-
Length —distance and dimension
Metric base: 1 m. 1 km = 1000 m, 1 cm = 0.01 m, 1 mm = 0.001 m. Imperial: 1 in = 2.54 cm (exact), 1 ft = 12 in = 0.3048 m (exact), 1 yd = 3 ft = 0.9144 m, 1 mi = 5280 ft = 1609.344 m (exact). Nautical: 1 nmi = 1852 m (exact).
-
Mass / weight
Metric base: 1 kg. 1 g = 0.001 kg, 1 t (metric ton) = 1000 kg. Imperial: 1 lb = 0.45359237 kg (exact), 1 oz = 1/16 lb = 28.349523125 g (exact), 1 stone = 14 lb = 6.35029318 kg. US short ton = 2000 lb; metric tonne = 1000 kg ≥2204.62 lb.
-
Temperature —an affine transform
Celsius to Fahrenheit: °F = °C × 9/5 + 32. Fahrenheit to Celsius: °C = (°F - 32) × 5/9. Celsius to Kelvin: K = °C + 273.15. Kelvin to Celsius: °C = K - 273.15. Fahrenheit to Kelvin: K = (°F - 32) × 5/9 + 273.15. Note: never say 'degrees Kelvin' —it is just kelvin.
-
Area —two-dimensional extent
Metric: 1 m², 1 ha = 10000 m², 1 km² = 1000000 m². Imperial: 1 in² = 6.4516 cm² (exact), 1 ft² = 0.09290304 m² (exact), 1 acre = 43560 ft² = 4046.8564224 m² (exact), 1 mi² = 640 acres = 2.5899934473296 km². 1 hectare ≥2.47105 acres.
-
Apply the conversion correctly
For multiplicative units: target = source × factor. For temperature: apply the affine formula (multiply then add/subtract). Always carry units through the calculation and cancel them —this catches factor-direction mistakes (multiplying when you should divide).
Examples
Miles to kilometers
Input: 26.2 mi (a marathon)
Output: 26.2 × 1.609344 = 42.1649 km
Pounds to kilograms
Input: 150 lb
Output: 150 × 0.45359237 = 68.0389 kg
Celsius to Fahrenheit
Input: 100 °C (boiling water)
Output: 100 × 9/5 + 32 = 212 °F
Acres to square meters
Input: 2.5 acres
Output: 2.5 × 4046.8564224 = 10117.14 m² (≥1.0117 ha)
Common Problems
- Confusing US short ton (2000 lb) with metric tonne (1000 kg) and UK long ton (2240 lb): they differ by ~10%. Always state which ton is meant in cross-border trade.
- Forgetting temperature is affine: '20 °C is 68 °F' is correct, but multiplying 20 by 9/5 without adding 32 gives 36, which is wrong. Temperature conversion requires the offset, not just a factor.
- Using 2.2 as an exact lb-to-kg factor: the exact value is 0.45359237 kg/lb (1/0.45359237 ≥2.20462262). Using 2.2 introduces ~0.2% error, which compounds in large quantities.
- Squaring linear factors incorrectly for area: 1 ft = 0.3048 m, so 1 ft² = 0.3048² = 0.09290304 m², not 0.3048 m². Area factors are the square of length factors; volume factors are the cube.
Tips
- Carry units through every step and cancel them like algebra —'dimensional analysis' catches most conversion mistakes before you compute a number.
- Memorize a few anchor conversions to sanity-check results: 1 in ≥2.5 cm, 1 kg ≥2.2 lb, 1 mi ≥1.6 km, 1 L ≥1.06 US qt.
- For temperature, remember the three anchor points: 0 °C = 32 °F (freezing), 100 °C = 212 °F (boiling), -40 °C = -40 °F (the point where the two scales cross).
- Use our Unit Converter for one-off conversions and keep this reference for the formulas —knowing the factor lets you convert in any tool or spreadsheet without internet.