What happens if we put raw text directly in the <ul> element?

List have three categories…

UL    =>  unordered list

OL    =>  ordered list

DL    =>  definition list

If we write LI by itself, the browser doesn’t know how to categorize it as a list, and it also doesn’t actually know it IS a list. The LI is akin to being a P, at that point. The category wrapper is a container with all the list items as child elements. The browser now knows what styles to give them by default such as, margin, padding, list-style-type (bullets, numbers, letters), etc.

42 Likes