CSS Lists

We already learn order list and unordered list in HTML tutorial. We can modify list using CSS.

Different List Item Markers

The list-style-type property specifies the type of list item marker.

Note: Some of the values are for unordered lists, and some for ordered lists.

See the Pen lists 1 by Arpit (@soniarpit) on CodePen.

An Image as The List Item Marker

We can also display small images as the list item bullet using list-style-image property.

See the Pen list 2 by Arpit (@soniarpit) on CodePen.

Position The List Item Markers

The list-style-position property specifies the position of the list-item markers (bullet points).

See the Pen list 3 by Arpit (@soniarpit) on CodePen.

Remove Default Settings

The list-style-type:none property can also be used to remove the markers/bullets. Note that the list also has default margin and padding. To remove this, add margin:0 and padding:0 to

    or

      Try this example

      ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
      }
      
      

      List - Shorthand property

      The list-style property is a shorthand property. It is used to set all the list properties in one declaration

      ul {
        list-style: square inside url("sqpurple.gif");
      }
      

      When using the shorthand property, the order of the property values are:

      • list-style-type (if a list-style-image is specified, the value of this property will be displayed if the image for some reason cannot be displayed)
      • list-style-position (specifies whether the list-item markers should appear inside or outside the content flow)
      • list-style-image (specifies an image as the list item marker)

      If one of the property values above are missing, the default value for the missing property will be inserted, if any.

      Previous: CSS Padding

      Next: CSS Position