Learn how to use HTML font styling attributes and CSS to display the word "PAKISTAN" in multiple font styles, colors, and text decorations.
To write an HTML program that displays the word "PAKISTAN" in different fonts, colors, and styles using HTML tags and CSS.
In this practical, you will learn how to apply different fonts, colors, and text styles to the word "PAKISTAN". You can use:
style attribute<font> (older method, not recommended)font-family, color, font-size, font-weight, text-decoration, etc.style attribute is the simplest way to apply inline styles to individual elements.
| CSS Property | Purpose | Example Value |
|---|---|---|
font-family |
Sets the font type | 'Playfair Display', serif |
color |
Sets the text color | #1a5276 (hex), red, rgb() |
font-size |
Sets the text size | 2.8em, 32px, 200% |
font-weight |
Sets the boldness | 700 (bold), 900 (extra bold) |
letter-spacing |
Space between letters | 6px, 0.2em |
text-decoration |
Underline, overline, etc. | underline wavy #e74c3c |
text-transform |
Changes text case | uppercase, lowercase |
<font> tag is deprecated in HTML5. Use CSS instead for better control and maintainability.
| Mistake | Why It's Wrong | Correct Way |
|---|---|---|
Using <font> tag |
Deprecated in HTML5 | Use CSS style attribute or <style> tag |
Forgetting to close quotes in style |
Invalid CSS, won't work | Always use matching quotes: style="color: red;" |
| Using unsupported font names | Browser will fallback to default | Use web-safe fonts or link Google Fonts |
Mixing inline styles with <style> |
Can cause conflicts | Be consistent; use one method |
You have successfully:
ایک HTML پروگرام لکھنا جو لفظ "PAKISTAN" کو مختلف فونٹس، رنگوں، اور اسٹائلز میں HTML ٹیگز اور CSS کا استعمال کرتے ہوئے ظاہر کرے۔
اس عملی میں، آپ لفظ "PAKISTAN" پر مختلف فونٹس، رنگ، اور ٹیکسٹ اسٹائل لگانا سیکھیں گے۔ آپ استعمال کر سکتے ہیں:
style اٹریبیوٹ کے ساتھ Inline CSS<font> جیسے HTML ٹیگز (پرانا طریقہ، تجویز نہیں)font-family، color، font-size، font-weight، text-decoration جیسی CSS پراپرٹیزstyle اٹریبیوٹ انفرادی عناصر پر ان لائن اسٹائل لگانے کا سب سے آسان طریقہ ہے۔
| CSS پراپرٹی | مقصد | مثال کی قیمت |
|---|---|---|
font-family |
فونٹ کی قسم سیٹ کرتا ہے | 'Playfair Display', serif |
color |
ٹیکسٹ کا رنگ سیٹ کرتا ہے | #1a5276 (hex)، red، rgb() |
font-size |
ٹیکسٹ کا سائز سیٹ کرتا ہے | 2.8em، 32px، 200% |
font-weight |
موٹائی سیٹ کرتا ہے | 700 (bold)، 900 (extra bold) |
letter-spacing |
حروف کے درمیان فاصلہ | 6px، 0.2em |
text-decoration |
انڈر لائن، اوورلائن وغیرہ | underline wavy #e74c3c |
text-transform |
ٹیکسٹ کیس تبدیل کرتا ہے | uppercase، lowercase |
<font> ٹیگ HTML5 میں متروک (deprecated) ہے۔ بہتر کنٹرول اور دیکھ بھال کے لیے CSS استعمال کریں۔
| غلطی | یہ کیوں غلط ہے | صحیح طریقہ |
|---|---|---|
<font> ٹیگ کا استعمال |
HTML5 میں متروک | CSS style اٹریبیوٹ یا <style> ٹیگ استعمال کریں |
style میں کوٹس بند کرنا بھولنا |
غلط CSS، کام نہیں کرے گا | ہمیشہ مماثل کوٹس استعمال کریں: style="color: red;" |
| غیر معاون فونٹ نام کا استعمال | براؤزر ڈیفالٹ پر واپس آجائے گا | ویب‑سیف فونٹس استعمال کریں یا Google Fonts لنک کریں |
ان لائن اسٹائل کو <style> کے ساتھ ملانا |
تنازعات کا سبب بن سکتا ہے | مستقل رہیں؛ ایک طریقہ استعمال کریں |
آپ نے کامیابی سے: