Tables and lists in HTML

In this article we want to talk about Tables and lists in HTML, HTML (Hypertext Markup Language) is standard markup language used for creating web pages. HTML provides different elements for organizing content, including tables and lists. in this article we are going to explore basics of creating tables and lists in HTML.

 

 

Tables are useful way to display data in tabular format on web pages. for creating tables in HTML we use table element. table consists of one or more rows, which are defined using tr element. each row can contain one or more cells which are defined using the td element.

 

 

This is an example of simple table in HTML:

In the above code we have created table element. within table we have created three rows using tr element. each row contains two cells, which are defined using td element. we can also add heading row to the table using th element instead of td.

 

 

We can use CSS (Cascading Style Sheets) to style tables and its elements. this is an example of adding some basic styles to the table:

 

 

 

Now let’s talk about lists, so Lists are useful way to organize content on web pages. HTML provides two types of lists: ordered lists (<ol>) and unordered lists (<ul>). ordered list is  numbered list of items, while an unordered list is bulleted list of items. each list item is defined using the <li> element.

 

 

This is an example of simple ordered list in HTML:

In the above code we have created an ordered list using the <ol> element, and three list items using the <li> element.

 

 

This is an example of simple unordered list in HTML:

In the above code we have created an unordered list using the <ul> element, and three list items using the <li> element.

 

 

We can also create nested lists by placing list inside another list item. this is an example of  nested list in HTML:

 

 

Learn More on Python

Leave a Comment