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 tags

  • audio
  • input checkbox
  • label
  • li
  • ol
  • pre
  • template
  • ul
  • video
 
  • Home
  • > Tutorials
  • > HTML
  • > HTML tag

HTML ul tag

on Mar 11, 2016

HTML ul tag (<ul>) can be used to create unordered list. It can contain multiple list items using tag li (<li>) and it can be styled using css. Also note that there can be nested lists (using ul and/or ol) also.

Attributes

  1. type (obsolete in HTML5)
  2. compact (obsolete in HTML5)

CSS properties specific to lists

  • list-style
  • list-style-image
  • list-style-type
  • list-style-position

Example – ul tag with default list-style-type

<style>
ul {
  background-color: lightgreen;
  width: 200px;
}
li {background-color:lightgray;}
</style>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
refresh done
try it online

Example – ul tag with circle list-style-type

<style>
ul {
  background-color: lightgreen;
  width: 200px;
  list-style-type: circle;
}
li {background-color:lightgray;}
</style>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
refresh done
try it online

Example – ul tag with outside list-style-position

Property list-style-position has default value outside.

<style>
ul {
  background-color: lightgreen;
  width: 200px;
  list-style-position: outside; /* default */
}
li {background-color:lightgray;}
</style>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
refresh done
try it online

Example – ul tag with inside list-style-position

<style>
ul {
  background-color: lightgreen;
  width: 200px;
  list-style-position: inside;
}
li {background-color:lightgray;}
</style>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
refresh done
try it online

Example – ul tag with reduced left padding

<style>
ul {
  background-color: lightgreen;
  width: 200px;
  list-style-position: outside;
  padding: 0 0 0 20px;
}
li {background-color:lightgray;}
</style>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
refresh done
try it online

Related

  • CSS list-style - shorthand for list marker type, image and position
  • CSS list-style-type - specify marker (disc, square, numeric, etc.) for a list
  • CSS list-style-position - specify if list markers will be outside or inside
  • CSS list-style-image - use image as marker in list
  • HTML li tag
  • HTML ol tag

Specification

  • W3C HTML5 ul (unordered list) specification

Suggested posts:

  1. Running php eval on code with tags
  2. PHP – print array in one line
  3. CSS selector specificity
  4. WordPress – write custom php log to separate file
  5. wget handy commands
  6. WordPress mysql query to get all posts with a specific custom field
  7. jQuery – find select element selectedIndex, value and text
  8. jQuery how to load a url into an element
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged HTML tag, 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