Jshulman
Jshulman

Reputation: 1

Usages of <ul> for formatting

I tend to use <li> all the time to format and position text. It's works, I just don't want to be creating a website the wrong way. I'm new to this and I want to learn the proper ways.

Am I using unordered lists the right way?

Upvotes: 0

Views: 75

Answers (2)

Vin Burgh
Vin Burgh

Reputation: 1419

CSS should be used to format and position text and elements. Unordered lists (<ul>) are for semantics only; the same is true for any HTML element. Also, while browsers do apply default formatting and styling for certain elements, these browser-specific default styles shouldn't be heavily relied on.

Use <ul> and/or <ol> because you want to display a list or lists, don't use it because browsers apply automatic indentation.

Upvotes: 1

feeela
feeela

Reputation: 29932

A list is a list. If your whole website consists of list-content's, than you should use lists. But if not you should remember, that HTML has a lot more tags than just UL and LI. Choose those tags that match the semantic meaning of the content. For example a P for text paragraphs or even the new HTML5 tags like ARTICLE to enclose a whole post.

Beside real list contents, like staff members on a company website, I use lists primarly in two cases: A) as navigation menus and B) to format forms (where each LI is a form row, containing a LABEL and some input).

Upvotes: 0

Related Questions