The documentation (http://www.w3schools.com/tags/att_li_value.asp) says, that a value for a li element must be numeric. Why should it be wrong to use a string instead of a number, if you need the value for saving a f.E. locale like 'US', 'EN' etc. ?

Recommended Answers

All 3 Replies

Member Avatar for diafol

No, <li> is a list item, it can take any manner of numbers, letters or bullets. You are referring to the parent tag, <ol>, which stands for 'ordered list' (numbers by default) as opposed to <ul> which stands for unordered list (bullets usually).

The style of these list items can be set via CSS:

`list-style`, `list-style-type` (or `list-style-image` if you wish to provide your own bullets)    

This can override the specified ol/ul so that ol can be bulleted and ul can be numbered. BUT, semantically choose the right tag for the job.

Member Avatar for diafol

Here's a screenshot of the various types:

0cfdc48252541e10ebb251bba4e5fe44

Not sure what you're getting at with this:

If you need the value for saving a f.E. locale like 'US', 'EN' etc. ?

Some solutions here for using characters as bullets (unordered):

http://stackoverflow.com/questions/7698764/custom-bullet-symbol-for-li-elements-in-ul-that-is-a-regular-character-and

Be careful with using non-numerics for ordered lists. For example, what happens to alphabetics (latin/alpha) once you go beyond 26 items?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.