Yogesh Chauhan's Blog

Styling Lists with CSS

in CSS on September 24, 2020

There are three different properties for styling list-items:

1. list-style-type (default: disc) 
2. list-style-image (default: outside) 
3. list-style-position (default: none) 

NOTE: above properties need to be declared in that order.

We can declare each property separately, or we can use list-style shorthand property.

list-style-type

list-style-type defines the shape/type of bullet point for each list-item.

We can add these values for list-style-type:

1. disc
2. circle
3. square
4. decimal
5. lower-roman
6. upper-roman
7. none

Example


li {
 list-style-type: square;
}

li {
 list-style-type: circle;
}

list-style-image

If we want to display an image instead of bullet point, we can use  list-style-image.

We can pass URL or local image as value.


li {
 list-style-image: url(images/image.png);
}

list-style-position

It defines where to position the list-item marker. We can add two values, either “inside” or “outside”.


li {
 list-style-position: outside;
}

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface #Jan 14 How to display a student’s individual transcript in Colleague? #Jan 11 How to install PuTTY on a MacOS?
You might also like these
What is the difference between let and var in Swift?Swift2 Ways We Can Write Multiple Line Commands in PHPPHPHow to create a pricing table using flex in CSS?CSSFive common features of Angular template syntax (with examples)AngularWhat is React? Learn the basicsReactColleague UI Basics: The Search AreaColleaguefor @each loop in SCSSSCSSHow to add and remove capabilities from a role in WordPress?WordPressHow to define variables in SCSS (Sass)?SCSSWhy does MOV matter in IT or any kind of projects?MiscellaneousAdd animated hamburgers menu using Hamburgers collection on GitHubCSSWhy do we need HAVING Clause in SQL?SQL/MySQL