Jump to content

Why use <ul> and <li> tags?


lAZLf

Recommended Posts

It's not so much a benefit about what is correct, and what isn't. Li tags are for lists, div tags are for divisions of your page. They are different things.

 

List tags will also render as lists, and allow you to add bullet points as numbers, circles, roman numerals etc. You can't do this with divs. And finally, you will get better search engine results if you use semantic markup. Semantic markup involves making the content of a tag match the tag. Since a list isn't a division on your page, putting a list in a div tag doesn't tell the search engines that it is a list. Putting the list in list tags however tells the search engines its a list.

Link to comment
https://forums.phpfreaks.com/topic/186296-why-use-and-tags/#findComment-983878
Share on other sites

  • 2 weeks later...

I would say a good example of using ul and li is when you want to display a custom bullet image for a list with css. It may seem obvious, but before I realized it I was using an img tag to show an image before each item in a list. Using ul and li instead of img cuts down file size a hell of a lot.

Link to comment
https://forums.phpfreaks.com/topic/186296-why-use-and-tags/#findComment-989415
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.