{"id":7915,"date":"2022-09-26T12:51:38","date_gmt":"2022-09-26T12:51:38","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=7915"},"modified":"2022-09-26T12:51:38","modified_gmt":"2022-09-26T12:51:38","slug":"html-lists","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/09\/26\/html-lists\/","title":{"rendered":"HTML Lists"},"content":{"rendered":"\n<p>In HTML, there are three types of lists: unordered, ordered and description lists. Each of them is defined using different tags. Let\u2019s have a look.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"html-unordered-lists-2\">HTML Unordered Lists<\/h2>\n\n\n\n<p>We use unordered lists to group items having no numerical order. When changing the order of list items, the meaning will not change. To create an unordered list, we use the\u00a0&lt;ul>\u00a0tag. This tag comes in pairs, the content is written between opening &lt;ul> and closing &lt;\/ul> tags.<\/p>\n\n\n\n<p>Each element of an unordered list is declared inside the\u00a0&lt;li>\u00a0tag.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-lt-ul-gt-tag-for-creating-an-unordered-list-4\">Example of the HTML &lt;ul&gt; tag for creating an unordered list:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h1&gt;An unordered list:&lt;\/h1&gt;\n    &lt;ul&gt;\n      &lt;li&gt;This is a list item&lt;\/li&gt;\n      &lt;li&gt;This is another list item&lt;\/li&gt;\n      &lt;li&gt;This is one more list item&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>The items in unordered lists are marked with bullets (small black circles) by default. However, the default bullet style for the list items can be changed using a&nbsp;type&nbsp;attribute.<\/p>\n\n\n\n<p>The&nbsp;type&nbsp;attribute is used to change the default bullet style for the list items.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-lt-ul-gt-tag-for-creating-an-unordered-list-where-the-items-are-marked-with-bullets-7\">Example of the HTML &lt;ul&gt; tag for creating an unordered list, where the items are marked with bullets:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;ul type=\"circle\"&gt;\n      &lt;li&gt;List item &lt;\/li&gt;\n      &lt;li&gt;List item&lt;\/li&gt;\n      &lt;li&gt;List item&lt;\/li&gt;\n    &lt;\/ul&gt;\n    &lt;ul type=\"square\"&gt;\n      &lt;li&gt;List item&lt;\/li&gt;\n      &lt;li&gt;List item&lt;\/li&gt;\n      &lt;li&gt;List item&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"result-9\">Result<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/mdr.foobrdigital.com\/wp-content\/uploads\/2022\/09\/image-45.png\" alt=\"\" class=\"wp-image-7916\"\/><\/figure>\n\n\n\n<p>You can also use the CSS\u00a0list-style-type\u00a0or\u00a0list-style-image\u00a0property to specify the type of a list item element.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-lt-ul-gt-tag-used-with-the-css-list-style-type-property-for-creating-an-unordered-list-11\">Example of the HTML &lt;ul&gt; tag used with the CSS list-style-type property for creating an unordered list:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h2&gt;Examples of unordered lists:&lt;\/h2&gt;\n    &lt;ul style=\"list-style-type: square;\"&gt;\n      &lt;li&gt;Cold Drinks&lt;\/li&gt;\n      &lt;li&gt;Hot Drinks&lt;\/li&gt;\n      &lt;li&gt;Ice-Creams&lt;\/li&gt;\n    &lt;\/ul&gt;\n    &lt;ul style=\"list-style-type: disc;\"&gt;\n      &lt;li&gt;Coca-Cola&lt;\/li&gt;\n      &lt;li&gt;Fanta&lt;\/li&gt;\n      &lt;li&gt;Ice Tea&lt;\/li&gt;\n    &lt;\/ul&gt;\n    &lt;ul style=\"list-style-type: circle;\"&gt;\n      &lt;li&gt;Coca-Cola&lt;\/li&gt;\n      &lt;li&gt;Fanta&lt;\/li&gt;\n      &lt;li&gt;Ice Tea&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"html-ordered-lists-13\">HTML Ordered Lists<\/h2>\n\n\n\n<p>HTML ordered list is used for listing items that are marked with numbers. It starts with the\u00a0&lt;ol>\u00a0tag. This tag comes in pairs, the content is written between opening &lt;ol> and closing &lt;\/ol> tags.<\/p>\n\n\n\n<p>Each item in the ordered list starts with opening &lt;li&gt; tag and ends with &lt;\/li&gt; closing tag.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-lt-ol-gt-tag-for-creating-an-ordered-list-15\">Example of the HTML &lt;ol&gt; tag for creating an ordered list:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h1&gt;An ordered list:&lt;\/h1&gt;\n    &lt;ol&gt;\n      &lt;li&gt;This is List item number 1&lt;\/li&gt;\n      &lt;li&gt;This is List item number 2&lt;\/li&gt;\n      &lt;li&gt;This is List item number 3&lt;\/li&gt;\n    &lt;\/ol&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>The items in the ordered list are marked with numbers by default. If you want to create ordered list with alphabet or Roman numbers, you just need to add&nbsp;type=&#8221;a&#8221;&nbsp;or&nbsp;type=&#8221;I&#8221;&nbsp;to the &lt;ol&gt; tag.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-lt-ol-gt-tag-for-creating-an-ordered-list-with-alphabet-and-roman-numbers-18\">Example of the HTML &lt;ol&gt; tag for creating an ordered list with alphabet and Roman numbers:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h3&gt;A numbered list:&lt;\/h3&gt;\n    &lt;ol&gt;\n      &lt;li&gt;Peach&lt;\/li&gt;\n      &lt;li&gt;Apricot&lt;\/li&gt;\n      &lt;li&gt;Banana&lt;\/li&gt;\n      &lt;li&gt;Strawberry&lt;\/li&gt;\n    &lt;\/ol&gt;\n    &lt;h3&gt;An alphabetized list:&lt;\/h3&gt;\n    &lt;ol type=\"A\"&gt;\n      &lt;li&gt;Peach&lt;\/li&gt;\n      &lt;li&gt;Apricot&lt;\/li&gt;\n      &lt;li&gt;Banana&lt;\/li&gt;\n      &lt;li&gt;Strawberry&lt;\/li&gt;\n    &lt;\/ol&gt;\n    &lt;h3&gt;An alphabetized list (lowercase letters):&lt;\/h3&gt;\n    &lt;ol type=\"a\"&gt;\n      &lt;li&gt;Peach&lt;\/li&gt;\n      &lt;li&gt;Apricot&lt;\/li&gt;\n      &lt;li&gt;Banana&lt;\/li&gt;\n      &lt;li&gt;Strawberry&lt;\/li&gt;\n    &lt;\/ol&gt;\n    &lt;h3&gt;A numbered list (Roman numerals):&lt;\/h3&gt;\n    &lt;ol type=\"I\"&gt;\n      &lt;li&gt;Peach&lt;\/li&gt;\n      &lt;li&gt;Apricot&lt;\/li&gt;\n      &lt;li&gt;Banana&lt;\/li&gt;\n      &lt;li&gt;Strawberry&lt;\/li&gt;\n    &lt;\/ol&gt;\n    &lt;h3&gt;A numbered list (lowercase Roman numerals):&lt;\/h3&gt;\n    &lt;ol type=\"i\"&gt;\n      &lt;li&gt;Peach&lt;\/li&gt;\n      &lt;li&gt;Apricot&lt;\/li&gt;\n      &lt;li&gt;Banana&lt;\/li&gt;\n      &lt;li&gt;Strawberry&lt;\/li&gt;\n    &lt;\/ol&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"html-description-lists-20\">HTML Description Lists<\/h2>\n\n\n\n<p>HTML description list is used to arrange terms or names with a description the same way as they are arranged in a dictionary.<\/p>\n\n\n\n<p>To create a description list, we use the\u00a0&lt;dl>\u00a0tag. This tag comes in pairs.<\/p>\n\n\n\n<p>In &lt;dl>, we use\u00a0&lt;dt>\u00a0tags for a term\/name in a description list and\u00a0&lt;dd>\u00a0for a description of a term\/name in a description list.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-the-html-lt-dl-gt-tag-for-creating-a-description-list-22\">Example of the HTML &lt;dl&gt; tag for creating a description list:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h1&gt;Description Lists:&lt;\/h1&gt;\n    &lt;dl&gt;\n      &lt;dt&gt;Tea&lt;\/dt&gt;\n      &lt;dd&gt;- hot drink&lt;\/dd&gt;\n      &lt;dt&gt;Juice&lt;\/dt&gt;\n      &lt;dd&gt;- cold drink&lt;\/dd&gt;\n    &lt;\/dl&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"result-24\">Result<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/mdr.foobrdigital.com\/wp-content\/uploads\/2022\/09\/image-46.png\" alt=\"\" class=\"wp-image-7917\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"html-nested-lists-26\">HTML Nested Lists:<\/h2>\n\n\n\n<p>A nested list contains a list inside a list.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-an-html-nested-list-28\">Example of an HTML nested list:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h2&gt;A nested HTML list&lt;\/h2&gt;\n    &lt;p&gt;A nested list contains a list inside a list.&lt;\/p&gt;\n    &lt;ul&gt;\n      &lt;li&gt;Copybooks&lt;\/li&gt;\n      &lt;li&gt;\n        Books\n        &lt;ul&gt;\n          &lt;li&gt;Detective books&lt;\/li&gt;\n          &lt;li&gt;Roman books&lt;\/li&gt;\n          &lt;li&gt;Fairy tale books&lt;\/li&gt;\n        &lt;\/ul&gt;\n      &lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"list-counting-control-30\">List Counting Control<\/h2>\n\n\n\n<p>By default, the enumeration in an ordered list starts from 1. Use the&nbsp;start&nbsp;attribute to start counting from a specified number.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-an-html-list-for-counting-from-a-specified-number-32\">Example of an HTML list for counting from a specified number:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;Title of the document&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h2&gt;List counting control&lt;\/h2&gt;\n    &lt;p&gt;By default, the numeration in an ordered list starts from 1. Use the start attribute to start counting from a specified number.&lt;\/p&gt;\n    &lt;ol start=\"40\"&gt;\n      &lt;li&gt;Pen&lt;\/li&gt;\n      &lt;li&gt;Pencil&lt;\/li&gt;\n      &lt;li&gt;Copybook&lt;\/li&gt;\n    &lt;\/ol&gt;\n    &lt;ol type=\"I\" start=\"40\"&gt;\n      &lt;li&gt;Pen&lt;\/li&gt;\n      &lt;li&gt;Pencil&lt;\/li&gt;\n      &lt;li&gt;Copybook&lt;\/li&gt;\n    &lt;\/ol&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"horizontal-list-with-css-34\">Horizontal List with CSS<\/h2>\n\n\n\n<p>HTML lists can be styled in many different ways with CSS.<\/p>\n\n\n\n<p>You can style HTML lists using different CSS properties. For example, you can create a navigation menu styling the list horizontally.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-of-a-horizontal-list-with-css-36\">Example of a horizontal list with CSS:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html>\n&lt;html>\n  &lt;head>\n    &lt;title>Title of the document&lt;\/title>\n    &lt;style>\n      ul {\n        list-style-type: none;\n        margin: 0;\n        padding: 0;\n        overflow: hidden;\n        background-color: #F44336;\n      }\n      li {\n        float: left;\n      }\n      li a {\n        display: block;\n        color: white;\n        text-align: center;\n        padding: 16px;\n        text-decoration: none;\n      }\n      li a:hover {\n        background-color: #981816;\n      }\n    &lt;\/style>\n  &lt;\/head>\n  &lt;body>\n    &lt;h2>Navigation Menu Example&lt;\/h2>\n    &lt;p>\n      You can style HTML lists using different CSS properties. For example, you can create a navigation menu styling the list horizontally.\n    &lt;\/p>\n    &lt;ul>\n      &lt;li>\n        &lt;a href=\"#home\">Home&lt;\/a>\n      &lt;\/li>\n      &lt;li>\n        &lt;a href=\"https:\/\/www.google.com\/tool\/\">Tools&lt;\/a>\n      &lt;\/li>\n      &lt;li>\n        &lt;a href=\"https:\/\/www.google.com\/snippets\">Snippets&lt;\/a>\n      &lt;\/li>\n      &lt;li>\n        &lt;a href=\"https:\/\/www.google.com\/quiz\/\">Quizzes&lt;\/a>\n      &lt;\/li>\n      &lt;li>\n        &lt;a href=\"https:\/\/www.google.com\/string-functions\/\">String Functions&lt;\/a>\n      &lt;\/li>\n    &lt;\/ul>\n  &lt;\/body>\n&lt;\/html><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In HTML, there are three types of lists: unordered, ordered and description lists. Each of them is defined using different tags. Let\u2019s have a look. HTML Unordered Lists We use unordered lists to group items having no numerical order. When changing the order of list items, the meaning will not change. To create an unordered [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[285],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/7915"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=7915"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/7915\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=7915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=7915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=7915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}