CSS font-size प्रॉपर्टी का उपयोग फॉन्ट के साइज़ को सेट करने के लिए किया जाता है। हम मान को पर्सेंटेज, पिक्सेल्स, cm, पॉइंट्स, em आदि यूनिट्स में और एब्सोल्यूट कीवर्ड में स्पेसिफाई कर सकते हैं। रिलेटिव मान एक्सेसिबिलिटी को अधिकतम करते हैं। डिफ़ॉल्ट font-size 16px या 12pt है।
सिंटैक्स
CSS font-size प्रॉपर्टी का सिंटैक्स निम्नलिखित है:
Selector { font-size: /*value*/ }निम्नलिखित उदाहरण CSS font-size प्रॉपर्टी को दर्शाते हैं:
उदाहरण
<!DOCTYPE html> <html> <head> <style> div { margin: auto; padding: 10px; text-align: center; width: 50%; border: 2px solid; border-radius: 15%; font-size: 1.4em; } </style> </head> <body> <div> one <div>two <div>three</div> </div> </div> </body> </html>आउटपुट
यह निम्नलिखित आउटपुट देता है:

उदाहरण
<!DOCTYPE html> <html> <head> <style> p { font-size: smaller; } #demo { font-size: initial; } p:last-of-type { font-size: 200%; } </style> </head> <body> <h2>Demo Heading</h2> <p>This is demo text 1.</p> <p id="demo">This is demo text 2. </p> <p>This is demo text 3.</p> </body> </html>आउटपुट
यह निम्नलिखित आउटपुट देता है:
