day - 4 html css

CSS Lists

❮ PreviousNext ❯




Unordered Lists:                       

  • Coffee
  • Tea
  • Coca Cola
  • Coffee
  • Tea
  • Coca Cola

Ordered Lists:

  1. Coffee
  2. Tea
  3. Coca Cola
  1. Coffee
  2. Tea
  3. Coca Cola

  • unordered lists (<ul>) - the list items are marked with bullets
  • ordered lists (<ol>) - the list items are marked with numbers or letters


he CSS list properties allow you to:
  • Set different list item markers for ordered lists
  • Set different list item markers for unordered lists
  • Set an image as the list item marker
  • Add background colors to lists and list items

Different List Item Markers

The list-style-type property specifies the type of list item marker.
The following example shows some of the available list item markers:

ul.a {
  list-style-type: circle;
}

ul.b {
  list-style-type: square;
}

ol.c {
  list-style-type: upper-roman;
}

ol.d {
  list-style-type: lower-alpha;
}
Try it Yourself »

An Image as The List Item Marker

The list-style-image property specifies an image as the list item marker
ul {
  list-style-image: url('sqpurple.gif');
}

  • Set different list item markers for ordered lists
  • Set different list item markers for unordered lists
  • Set an image as the list item marker
  • Add background colors to lists and list items
  
"list-style-position: outside;" means that the bullet points will be outside the list item. The start of each line of a list item will be aligned vertically. This is default:
  • Coffee - A brewed drink prepared from roasted coffee beans...
  • Tea
  • Coca-cola

list-style-position: inside;" means that the bullet points will be inside the list item. As it is part of the list item, it will be part of the text and push the text at the start:
  • Coffee - A brewed drink prepared from roasted coffee beans...
  • Tea
  • Coca-cola

ul.a {
  list-style-position: outside;
}

ul.b {
  list-style-position: inside;
}


PropertyDescription
list-styleSets all the properties for a list in one declaration
list-style-imageSpecifies an image as the list-item marker
list-style-positionSpecifies the position of the list-item markers (bullet points)
list-style-type





A possible desktop view
Specifies the type of list-item market
]






Comments

Popular Posts