css-unit-relative-em
RUN
<!DOCTYPE html> <html> <head> <style> body { font-size: 60px; } div { font-size: 30px; border: 1px solid black; } span { font-size: 0.5em; } </style> </head> <body> <div> font-size của phần tử div là 30px. <span>Phần tử span ở trong phần tử div có font-size là 0.5em, tương đương 0.5x30 = 15px</span>. </div> <span>Phần tử span bên trong phần tử body có font-size là 0,5em, phần tử body có font-size là 60, vậy font-size của phần tử span là 0.5x60 = 30px</span> </body> </html>
PHÓNG TO