स्केलेबल टेक्स्ट साइज़ के लिए, font-size को em में व्यक्त किया जाता है। डिफ़ॉल्ट रूप से एक em 16px या 12pt के बराबर होता है। इसका मान पैरेंट एलिमेंट के font-size के सापेक्ष होता है।
सिंटैक्स
CSS font-size प्रॉपर्टी का सिंटैक्स निम्नलिखित है:
Selector { font-size: /*value*/ }उदाहरण
निम्नलिखित उदाहरण दर्शाते हैं कि CSS font-size प्रॉपर्टी को ems में कैसे सेट किया जा सकता है:
<!DOCTYPE html> <html> <head> <style> div { width: 40%; border: 2px solid yellow; padding: 20px; font-size: 1em; } span { font-size: 2em; background-color: chartreuse; } </style> </head> <body> <div> <p>This is a demo paragraph<span> displaying font sizes</span> set with em in CSS.</p> </div> </body> </html>आउटपुट
यह निम्नलिखित आउटपुट देता है:

उदाहरण
<!DOCTYPE html> <html> <head> <style> table { width: 40%; border: 2px ridge red; font-size: 0.8em; } span { font-size: 1.5em; background-color: silver; } </style> </head> <body> <h2>Class Info</h2> <table> <tr> <th>Number of Students</th> </tr> <tr> <td>Class A</td> <td><span>50 Students</span></td> </tr> <tr> <td>Class B</td> <td><span>40 Students</span></td> </tr> </table> </body> </html>आउटपुट
यह निम्नलिखित आउटपुट देता है:
