The list-style Shorthand property in CSS

CSSWeb DevelopmentFront End Technology

The CSS list-style property is used to specify the list-style-type, list-style-position and list-style-image for an element.

Syntax

The syntax of CSS list-style property is as follows−

Selector {
   list-style: /*value*/
}

Example

The following examples illustrate styling of lists −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
body {
   font-size: 1.33em;
   background: linear-gradient(to right, orange, lightgreen, lightblue);
}
ol:first-of-type {
   box-shadow: inset 0 0 23px rgb(20,255,40);
   list-style: upper-alpha inside;
}
ul {
   list-style: circle;
}
</style>
</head>
<body>
<ol>
<li>Demo</li>
</ol>
<ol>
<li>Demo</li>
</ol>
<ul>
<li>demo</li>
<ol>
<li>demo</li>
</ol>
</ul>
</body>
</html>

Output

This gives the following output −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
ol {
   width: 40%;
   list-style: lower-roman;
}
li {
   border: thin solid hotpink;
   margin: 5px 30px;
}
</style>
</head>
<body>
<h2>Popular Sports</h2>
<ol>
<li>Football</li>
<li>Cricket</li>
<li>Tennis</li>
<li>Hockey</li>
<li>Volleyball</li>
<li>Basketball</li>
</ol>
</body>
</html>

Output

This gives the following output −

raja
Published on 06-Jan-2020 09:59:33
Advertisements