The Wayback Machine - https://web.archive.org/web/20241121022101/https://www.geeksforgeeks.org/css-list-style-image-property/
Open In App

CSS list-style-image Property

Last Updated : 27 Aug, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

CSS List-Style-Image Property is a handy tool that allows you to customize your list item markers with images. This property transforms your lists from ordinary to extraordinary, making your web pages more engaging and visually appealing.

Syntax:

list-style-image: none|url|initial|inherit;

Property Values:

none

This value specifies that no image is used as the marker. If this value is set, the marker defined in the list-style type is used instead. This is the default value. 

initial

This mode sets this property to its default value. 

url

In this value, the path to the image is used as a list-item marker. 

Methods to use List Style Image Property

1. Using CSS list style image property value as none:

Example: In this example, we are using list-style-image: none; property.

html
<!DOCTYPE html>
<html>
<head>
    <title>
        CSS list-style-image Property
    </title>
    <style>
        ul {
            list-style-image: none;
        }
    </style>
</head>

<body style="">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>

    <h2>
        CSS list-style-image Property
    </h2>

    <p>Sorting Algorithms</p>

    <ul>
        <li>Bubble Sort</li>
        <li>Selection Sort</li>
        <li>Merge Sort</li>
    </ul>
</body>
</html>

Output:

 liststyleimage

2. Using CSS list style image property value as url:

Example: In this example, we use list-style-image: url; property.

html
<!DOCTYPE html>
<html>
<head>
    <title>
        CSS list-style-image Property
    </title>
    <style>
        ul {
            list-style-image:
url("https://write.geeksforgeeks.org/wp-content/uploads/listitem-1.png");
        }
    </style>
</head>

<body style="">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>

    <h2>
        CSS list-style-image Property
    </h2>

    <p>Sorting Algorithms</p>

    <ul>
        <li>Bubble Sort</li>
        <li>Selection Sort</li>
        <li>Merge Sort</li>
    </ul>
</body>
</html>

Output:

 liststyleimage

Supported Browsers: The browser supported by list-style-image property are listed below:

  • Google Chrome 1.0 and above
  • Edge 12.0 and above
  • Internet Explorer 4.0 and above
  • Firefox 1.0 and above
  • Opera 7.0 and above
  • Apple Safari 1.0 and above

CSS list-style-image Property – FAQs

What is the purpose of the list-style-image property?

The list-style-image property allows you to use a custom image as the marker for list items instead of the default bullet or number.

How do I apply an image as the list marker?

You can use list-style-image: url(‘image.png’); to set an image as the marker for your list items.

What happens if the image fails to load?

If the image fails to load, the browser typically falls back to the default list marker style, like a bullet or number.

Can I resize the list marker image?

The list marker image cannot be directly resized with list-style-image. Instead, you would need to adjust the image itself or use pseudo-elements for more control.

Does list-style-image work with both ordered and unordered lists?

Yes, list-style-image can be applied to both <ul> (unordered lists) and <ol> (ordered lists), replacing the default markers in both cases.



Previous Article
Next Article

Similar Reads

How to remove CSS style of <style> tag using JavaScript/jQuery ?
Given an HTML document containing inline and internal CSS and the task is to remove the style of <style> tag. The internal or embedded CSS is used within the head section of the HTML document. It is enclosed within <style> tag. Approach: The jQuery remove() and empty() methods are used to remove the CSS style of <style> element. E
2 min read
How to resize list style image in CSS ?
In this article, we will learn to set an image or icon as the <li> image. We need to set the size of the custom list image to make it attractive. So, we will also learn the different ways to resize the custom list image. Syntax: In this article, we will use below CSS properties. background-image: We will add a custom image as a background ima
3 min read
How to Set the List Style Image in Tailwind CSS ?
Tailwind CSS is a Utility-first CSS framework for building rapid custom UI. It is a highly customizable, low-level CSS framework that gives you all the building blocks you need. These are the following approaches by using these we can customize the list-style image: Table of Content List Style Image in Tailwind CSSHandling Hover, Focus, and Other S
3 min read
CSS list-style Property
The list-style property in CSS is used to set the list style. the CSS list-style property is a shorthand for setting the list-style-type, list-style-position, and list-style-image properties in one declaration. It defines the appearance of list item markers, including their type (e.g., disc, circle), position, and custom images. Syntaxlist-style: l
3 min read
CSS list-style-position Property
CSS List-Style-Position Property is a key attribute that determines the position of the marker box about the principal block box. This property gives you the control to fine-tune the placement of your list markers, enhancing the structure and readability of your lists. Syntax: list-style-position: outside|inside|initial|inherit;Property values:outs
2 min read
CSS list-style-type Property
The list-style-type property is used to customize the look of list item markers, offering various options for discs, circles, squares, and more. Syntax: list-style-type: disc | circle | square | decimal | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | none | inherit;Property Values:disc This is the default value. The marker i
5 min read
How to Remove Default List Style from Unordered List in CSS ?
Unordered lists in HTML are typically styled with bullet points by default. However, there may be instances where you want to remove this default styling for a cleaner look or to apply custom styles. In this article, we will explore various methods to remove the default list styling for an unordered list using CSS. Table of Content Using the list-s
2 min read
React.js Blueprint Popover2 Style Minimal Style
BlueprintJS is a React-based UI toolkit for the web. This library is very optimized and popular for building interfaces that are complex data-dense for desktop applications. Popover2 Component provides a way for users to display floating content next to a target element. We can use the following approach in ReactJS to use the ReactJS Blueprint Popo
2 min read
CSS | border-inline-start-style Property
The border-inline-start-style property is an inbuilt property in CSS it is used to define the individual logical inline-end border property values in a single place in the style sheet. This property sets the border-style at the left of the defining element border. Syntax: border-inline-start-style: border-style; Property values: border-style: This
1 min read
CSS transform-style Property
The transform-style property is used to specify the children of an element are positioned in 3D space or flattened with respect to the plane of the element. Syntax: transform-style: flat|preserve-3d|initial|inherit; Property Values: flat: This value places the child elements in the same plane as the parent. It does not preserve the 3D position. It
3 min read
CSS | border-block-start-style Property
The border-block-start-style property in CSS is used to define the individual logical block-start border property values in a single place in the style sheet. This property sets the border-style at the top of the defining element border. Syntax: border-block-start-style: border-style; Property values: border-style: This property holds the style of
1 min read
CSS | border-block-style Property
The border-block-style property in CSS is used to set the individual logical block border-style property values in a single place in the style sheet. It sets the border style top, and bottom of the defining border element. Syntax: border-block-style: style; Property values: style: This property holds the style of the border dashed, border, dotted,
2 min read
CSS | border-inline-style Property
The border-inline-style property is an inbuilt property in CSS which is used to set the individual logical block inline-border-style property values in a single place in the style sheet. It sets the inline border-style top(left), and bottom(right) of the defining border element. Syntax: border-inline-style: style; Property values: style: This prope
1 min read
CSS | border-inline-end-style Property
The border-inline-end-style property in CSS is used to define the individual logical inline-end border property values in a single place in the style sheet. This property sets the border-style at the bottom of the defining element border. Syntax: border-inline-end-style: border-style; Property values: border-style: This property holds the style of
1 min read
How to Style the Text using text-decoration Property in CSS ?
The text-decoration property in CSS is used to style the decoration of text, such as underlining, overlining, line-through, and blink effects. It is a versatile property that can enhance the visual appearance of text. Syntax/* Example of using the text-decoration property */ .element { text-decoration: [value]; }The text-decoration Property ValuesT
1 min read
CSS border-bottom-style Property
The border-bottom-style property in CSS is used to set the style of the bottom border of an element.  Syntax:  border-bottom-style: none|hidden|dotted|dashed| solid|double|groove|ridge|inset| outset|initial|inherit;Property Values:  none: It is the default value and it makes the width of the bottom border zero. Hence, it is not visible.hidden: It i
6 min read
CSS border-left-style Property
The CSS border-left-style property is used to set the style of the left border of an element. Default Value: none Syntax:   border-left-style: none| hidden| dotted| dashed| solid| double | groove| ridge| inset| outset| initial| inherit;Properties Value:  ValueDescriptionnoneIt sets no left border.hiddenIt sets no border, except border conflict reso
3 min read
CSS border-right-style Property
The border-right-style property in CSS is used to change the appearance of the right line segment of the border of an element. Default Value: none Syntax: border-right-style: none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit; Property Values: none: It is the default value and it makes the width of right border to zero. Hence,
6 min read
CSS border-top-style Property
The border-top style property is used to specify the style of the top border. Syntax: border-top-style: none | dotted | dashed | solid | groove | inset | outset | ridge | double | hidden | initial | inherit;Default Value: The default value is none. Property Values None: It is the default value and it makes the width of the top border zero. Hence, i
5 min read
CSS border-style Property
CSS border-style Property is used to set the border style, and it is a shorthand property that sets the line style for all four sides of an element's border. Note: The border-style property can take One to Four values at a time. Default Value: none CSS border-style Property Syntax:border-style: value;CSS border-style Property Values:none: No border
4 min read
CSS column-rule-style Property
The column-rule-style property in CSS is used to set the style of the column rule between the columns on a multi-column layout. Syntax: column-rule-style: none|double|groove|ridge|inset|hidden|dotted| dashed|solid|outset|initial|inheritProperty Values: The column-rule-style property contains many values which are listed below: none: It is the defau
4 min read
CSS font-style Property
The CSS font-style property is used to style text in a normal, italic, or oblique face from its font family. This property helps to assign importance and decorate specific text, enhancing the overall user experience. The font-style property is an essential tool in CSS for designing and styling text effectively. Syntax: font-style: normal|italic|obl
4 min read
CSS outline-style Property
The outline-style property in CSS is used to set the appearance of the outline of an element. The outline and border of an element are similar, but not the same. The outline does not take space and it is drawn outside the border of an element. Also, the outline is drawn around all four sides of the element by default, and there is no way to alter t
6 min read
CSS text-decoration-style Property
The CSS text-decoration-style property sets the style of text decoration, such as solid, double, dotted, dashed, or wavy lines. It works with text-decoration-line and text-decoration-color to customize text appearance, enhancing visual presentation and user experience on web pages. Syntaxtext-decoration-style: solid|double|dotted|dashed|wavy|initia
6 min read
CSS border-block-end-style Property
The border-block-end-style property in CSS is used to set the style of the logical block-end border of an element. This property controls the appearance of the border at the block-end (bottom side in horizontal writing modes) of an element. Syntax: border-block-end-style: border-style;Property values: border-style: This property holds the style of
2 min read
How to use Google material icon as list-style in a webpage using HTML and CSS ?
Icons can be added to our HTML page from the icon library. All the icons in the library can be formatted using CSS. They can be customized according to size, colour, shadow, etc. They play a considerate part in materialize CSS. Materialize CSS provides a rich set of material icons of google which can be downloaded from Material Design specs. Librar
2 min read
Tailwind CSS List Style Position
This class accepts lots of value in tailwind CSS in which all the properties are covered as in class form. It is the alternative to the CSS list-style-position Property. This class specifies the position of the marker box with respect to the principal block box. List Style Position classes: list-inside: In this value, the marker is the first elemen
1 min read
How to use @counter-style rule to customize list item using CSS ?
In this article, we will see how the @counter-style rule can be used to customize each list item style in CSS. Most of the cases while developing web applications and web projects, we often make use of lists, i.e., an ordered list or unordered list, or a description list. Although, there exist some restrictions on the pre-defined list, i.e., we can
3 min read
Tailwind CSS List Style Type
This class accepts lots of value in tailwind CSS in which all the properties are covered as in class form. It is the alternative to the CSS List Style Type property. This class specifies the appearance of the list item marker (such as a disc, character, or custom counter style) if the ‘list-style-image’ has the value ‘none’. List Style Type classes
1 min read
How to apply emoji hex code in list-style type to create custom list point ?
You can pass emoji hex code in list-style-type for both ordered and unordered lists to create custom list points. We use the following syntax in the CSS. You need to write the hex code for emojis in your CSS list-style-type property. You can refer to the HTML emojis article to know the hex code for emojis. Syntax: ul, ol { list-style-type: "\write
1 min read
three90RightbarBannerImg