HTML / HTML Lists

Styling Lists with CSS

A tutorial about Styling Lists with CSS

Tutorial 3 of 5 5 resources in this section

Section overview

5 resources

Explains how to create and format ordered, unordered, and description lists.

Introduction

This tutorial aims to guide you on how to style lists using Cascading Style Sheets (CSS). CSS is a stylesheet language used for describing the look and formatting of a document written in HTML.

By the end of this tutorial, you will learn how to:

  • Apply CSS styles to unordered and ordered lists
  • Customize bullet points and numbers in lists
  • Add background color and borders to lists

Prerequisites:
Knowledge of basic HTML and CSS is required.

Step-by-Step Guide

CSS provides several properties that can be used to style lists. The list-style-type property is used to change the bullet point of an unordered list or the numbering system for an ordered list. The list-style-image property allows you to replace the list-item marker with an image. The list-style-position property specifies the position of the list-item marker.

Code Examples

  1. Changing the bullet point of an unordered list
/* CSS */
ul {
  list-style-type: circle;
}

In the above example, the list-style-type: circle; changes the bullet points of the unordered list to circles.

  1. Changing the numbering system of an ordered list
/* CSS */
ol {
  list-style-type: upper-roman;
}

In the above example, the list-style-type: upper-roman; changes the numbering system of the ordered list to uppercase Roman numerals.

  1. Using an image as list items marker
/* CSS */
ul {
  list-style-image: url('marker.png');
}

In the above example, the list-style-image: url('marker.png'); replaces the bullet points with the specified image.

  1. Changing the position of list-item markers
/* CSS */
ul {
  list-style-position: inside;
}

In the above example, the list-style-position: inside; sets the position of the list-item markers to inside.

Summary

In this tutorial, we've learned how to style lists using CSS. We've covered how to change the bullet points of an unordered list, the numbering system of an ordered list, how to use an image as the list items marker, and how to change the position of the list items marker.

Practice Exercises

  1. Exercise 1: Create an unordered list and change the bullet points to squares.

Solution:

css /* CSS */ ul { list-style-type: square; }

  1. Exercise 2: Create an ordered list and change the numbering system to lowercase alphabetical.

Solution:

css /* CSS */ ol { list-style-type: lower-alpha; }

  1. Exercise 3: Create an unordered list and use an image as the list items marker.

Solution:

css /* CSS */ ul { list-style-image: url('marker.png'); }

To further practice, try combining different CSS properties to style lists. Experiment with different values and observe the changes.

Need Help Implementing This?

We build custom systems, plugins, and scalable infrastructure.

Discuss Your Project

Related topics

Keep learning with adjacent tracks.

View category

CSS

Master CSS to style and format web pages effectively.

Explore

JavaScript

Learn JavaScript to add interactivity and dynamic behavior to web pages.

Explore

Python

Explore Python for web development, data analysis, and automation.

Explore

SQL

Learn SQL to manage and query relational databases.

Explore

PHP

Master PHP to build dynamic and secure web applications.

Explore

Popular tools

Helpful utilities for quick tasks.

Browse tools

Text Diff Checker

Compare two pieces of text to find differences.

Use tool

Scientific Calculator

Perform advanced math operations.

Use tool

JSON Formatter & Validator

Beautify, minify, and validate JSON data.

Use tool

Keyword Density Checker

Analyze keyword density for SEO optimization.

Use tool

Random Number Generator

Generate random numbers between specified ranges.

Use tool

Latest articles

Fresh insights from the CodiWiki team.

Visit blog

AI in Drug Discovery: Accelerating Medical Breakthroughs

In the rapidly evolving landscape of healthcare and pharmaceuticals, Artificial Intelligence (AI) in drug dis…

Read article

AI in Retail: Personalized Shopping and Inventory Management

In the rapidly evolving retail landscape, the integration of Artificial Intelligence (AI) is revolutionizing …

Read article

AI in Public Safety: Predictive Policing and Crime Prevention

In the realm of public safety, the integration of Artificial Intelligence (AI) stands as a beacon of innovati…

Read article

AI in Mental Health: Assisting with Therapy and Diagnostics

In the realm of mental health, the integration of Artificial Intelligence (AI) stands as a beacon of hope and…

Read article

AI in Legal Compliance: Ensuring Regulatory Adherence

In an era where technology continually reshapes the boundaries of industries, Artificial Intelligence (AI) in…

Read article

Need help implementing this?

Get senior engineering support to ship it cleanly and on time.

Get Implementation Help