हम एलिमेंट्स के फॉन्ट-साइज़ को स्पेसिफाई करने के लिए पर्सेंटेज और em के कॉम्बिनेशन का उपयोग कर सकते हैं ताकि फॉन्ट की बेहतर कम्पैटिबिलिटी हो। यह हमें अलग-अलग ब्राउज़र्स में यूनिफॉर्म टेक्स्ट रखने की अनुमति देता है।
सिंटैक्स
CSS font-size प्रॉपर्टी का सिंटैक्स निम्नलिखित है:
Selector { font-size: /*value*/ }उदाहरण
निम्नलिखित उदाहरण दर्शाते हैं कि CSS font-size प्रॉपर्टी को कीवर्ड्स के साथ कैसे सेट किया जा सकता है:
<!DOCTYPE html> <html> <head> <style> body { font-size: 80%; } p { font-size: 2em; } span { font-size: 4em; font-style: italic; } </style> </head> <body> <p>Reading <span>source code</span> written by others gives you opportunity to criticize the mistakes done in writing that code</p> </body> </html>आउटपुट
यह निम्नलिखित आउटपुट देता है:

उदाहरण
<!DOCTYPE html> <html> <head> <style> div { font-size: 120%; } p { font-size: 2em; } </style> </head> <body> <h3>Demo Heading</h3> This is example text. <div> Examples are easier to understand with practical implementation <p>This is another text just to display different ways to set font size in CSS.</p> </div> </body> </html>आउटपुट
यह निम्नलिखित आउटपुट देता है:
