Unordered lists (<ul>) display bullet points, while ordered lists (<ol>) show numbers or letters.
Customize bullets and numbers using list-style-type:
ul { list-style-type: disc; }ul { list-style-type: circle; }ul { list-style-type: square; }ol { list-style-type: decimal; }ol { list-style-type: decimal-leading-zero; }ol { list-style-type: lower-roman; }ol { list-style-type: upper-roman; }ol { list-style-type: lower-alpha; }ol { list-style-type: upper-alpha; }Defines if the bullet appears inside the list item's content box:
ul {
list-style-position: inside;
}Often used for navigation menus or layout elements:
ul {
list-style: none;
padding: 0;
margin: 0;
}Combine list properties in one line:
ul {
list-style: square inside;
}Use a background image to control size for a custom list marker:
ul {
list-style: none; /* remove default bullets */
}
ul li {
background: url('https://cdn-icons-png.flaticon.com/512/32/32355.png') no-repeat left center;
background-size: 32px 32px; /* adjust size here */
padding-left: 34px; /* space for the icon */
}Try building the following lists:
<ul style={{ listStyleType: "square", listStylePosition: "inside" }}>
<li>Milk</li>
<li>Eggs</li>
</ul>
<ol style={{ listStyleType: "upper-roman" }}>
<li>Rome</li>
<li>Greece</li>
</ol>
<ul style={{ listStyle: "none", padding: 0, margin: 0 }}>
<li>No bullet 1</li>
<li>No bullet 2</li>
</ul>You can copy and paste this code in your IDE to run!
Ask the AI if you need help understanding or want to dive deeper in any topic