Learn how to create both ordered (numbered) and unordered (bulleted) lists in HTML with different styling options.
To create an HTML program that demonstrates the creation of both ordered lists (<ol>) and unordered lists (<ul>) with different bullet and numbering styles.
HTML provides two main types of lists:
<ul>) — Displays items with bullets. Used when order doesn't matter.<ol>) — Displays items with numbers or letters. Used when order matters.<li> (list item) tags for each item.| Type Attribute | Bullet Style | Example |
|---|---|---|
type="disc" (default) |
Filled circle (●) |
|
type="circle" |
Hollow circle (○) |
|
type="square" |
Filled square (■) |
|
list-style-type: none; |
No bullets |
|
| Type Attribute | Numbering Style | Example |
|---|---|---|
type="1" (default) |
Decimal (1, 2, 3...) |
|
type="A" |
Uppercase letters (A, B, C...) |
|
type="a" |
Lowercase letters (a, b, c...) |
|
type="I" |
Uppercase Roman (I, II, III...) |
|
type="i" |
Lowercase Roman (i, ii, iii...) |
|
| Mistake | Why It's Wrong | Correct Way |
|---|---|---|
Using <ul> or <ol> without <li> |
Invalid HTML structure | Always use <li> for each item |
Putting text directly inside <ul> or <ol> |
Text won't display correctly | Always wrap text inside <li> |
| Incorrect nesting of lists | Broken list structure | Nested lists must be inside <li> |
Using type attribute in HTML5 |
Deprecated in HTML5 | Use CSS list-style-type |
| Forgetting to close tags | Invalid HTML | Always close all tags: <ul>...</ul> |
<li> tag for each list item.type attribute or CSS list-style-type.You have successfully:
<ul>) with different bullet styles.<ol>) with different numbering styles.type attribute on lists is deprecated in HTML5. Use CSS list-style-type for modern web development! Also, always use <li> for list items.
ایک HTML پروگرام بنانا جو ترتیب شدہ فہرستوں (<ol>) اور غیر ترتیب شدہ فہرستوں (<ul>) کی تخلیق کو مختلف بلٹ اور نمبرنگ اسٹائلز کے ساتھ ظاہر کرتا ہے۔
HTML دو اہم اقسام کی فہرستیں فراہم کرتا ہے:
<ul>) — آئٹمز کو بلٹس کے ساتھ ظاہر کرتی ہے۔ جب ترتیب کی کوئی اہمیت نہ ہو تو استعمال کریں۔<ol>) — آئٹمز کو نمبرز یا حروف کے ساتھ ظاہر کرتی ہے۔ جب ترتیب کی اہمیت ہو تو استعمال کریں۔<li> (فہرست کا آئٹم) ٹیگ استعمال کرتی ہیں۔| type صفت | بلٹ اسٹائل | مثال |
|---|---|---|
type="disc" (ڈیفالٹ) |
بھرا ہوا دائرہ (●) |
|
type="circle" |
کھوکھلا دائرہ (○) |
|
type="square" |
بھرا ہوا مربع (■) |
|
list-style-type: none; |
کوئی بلٹ نہیں |
|
| type صفت | نمبرنگ اسٹائل | مثال |
|---|---|---|
type="1" (ڈیفالٹ) |
ڈیسیمل (1, 2, 3...) |
|
type="A" |
بڑے حروف (A, B, C...) |
|
type="a" |
چھوٹے حروف (a, b, c...) |
|
type="I" |
بڑے رومن (I, II, III...) |
|
type="i" |
چھوٹے رومن (i, ii, iii...) |
|
| غلطی | یہ کیوں غلط ہے | صحیح طریقہ |
|---|---|---|
<li> کے بغیر <ul> یا <ol> کا استعمال |
غلط HTML ڈھانچہ | ہر آئٹم کے لیے ہمیشہ <li> استعمال کریں |
براہ راست <ul> یا <ol> کے اندر متن ڈالنا |
متن صحیح ظاہر نہیں ہوگا | متن کو ہمیشہ <li> کے اندر لپیٹیں |
| فہرستوں کی غلط نیسٹنگ | ٹوٹی ہوئی فہرست کا ڈھانچہ | نیسٹڈ فہرست <li> کے اندر ہونی چاہیے |
HTML5 میں type صفت کا استعمال |
HTML5 میں متروک | CSS list-style-type استعمال کریں |
| ٹیگز بند کرنا بھول جانا | غلط HTML | ہمیشہ تمام ٹیگز بند کریں: <ul>...</ul> |
<li> ٹیگ استعمال کرتی ہیں۔type صفت یا CSS list-style-type کا استعمال کرکے بلٹ/نمبرنگ اسٹائل تبدیل کر سکتے ہیں۔آپ نے کامیابی سے:
<ul>) والے HTML صفحات بنائے۔<ol>) والے HTML صفحات بنائے۔type صفت HTML5 میں متروک ہے۔ جدید ویب ڈیولپمنٹ کے لیے CSS list-style-type استعمال کریں! نیز، فہرست آئٹمز کے لیے ہمیشہ <li> استعمال کریں۔