InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

HTML cookbooks

  • HTML - is closing li tag required?
  • HTML form file upload hello world
  • How to disable spellcheck in textarea
 
  • Home
  • > Tutorials
  • > HTML
  • > HTML cookbook

HTML – is closing li tag required?

on Apr 16, 2016

HTML li tag can be used inside ul or ol tags. Its closing tag is optional and it makes html more readable and less verbose. So it can be safely omitted. Here is what spec says:

An li element's end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.

Example – li tag without closing tag

<ul>
<li>item1
<li>item2
</ul>
refresh done
try it online

Specification

  • W3C HTML5 li (list item) specification

Suggested posts:

  1. Running php eval on code with tags
  2. CSS selector specificity
  3. jQuery how to load a url into an element
  4. WordPress – write custom php log to separate file
  5. jQuery – find select element selectedIndex, value and text
  6. Python value in array (list) check
  7. PHP – print array in one line
  8. CSS text-overflow – truncate text with three dots
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged HTML, HTML cookbook, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress