The ::marker pseudo-element in CSS allows you to style the marker (bullet, number, or custom content) of a list item in an ordered (numbered) or unordered (bulleted) list. It provides the ability to customize the appearance of list item markers, making it useful for creating custom bullet styles or numbering formats. The ::marker pseudo-element can be applied to both <ul> (unordered list) and <ol> (ordered list) elements.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>::marker Pseudo-elements</title> <style> body { padding: 30px; } ul li::marker { color: red; font-size: 23px; } .ordered-list li::marker { color: red; font-weight: bold; } .symbol li::marker { content: " "; } h3.list { display: list-item; counter-increment: myList; } h3.list::marker { display: list-item; content: "#" counter(myList) " "; color: lightsalmon; font-weight: bold; } </style> </head> <body> <h3>::marker</h3> <ul> <li>Apple</li> <li>Orange</li> <li>Pineapple</li> <li>Papaya</li> <li>Mango</li> </ul> <ol class="ordered-list"> <li>Apple</li> <li>Orange</li> <li>Pineapple</li> <li>Papaya</li> <li>Mango</li> </ol> <ol class="symbol"> <li>Lorem ipsum dolor sit amet.</li> <li>Corporis aliquam excepturi neque deleniti.</li> <li>Incidunt eos repellendus vitae deserunt!</li> </ol> <hr /> <h3 class="list">HTML</h3> <p>HyperText Markup Language</p> <h3 class="list">CSS</h3> <p>Cascading Style Sheet</p> <h3 class="list">SASS</h3> <p>Syntactically Awesome Style Sheets</p> <h3 class="list">TJ</h3> <p>Tutor Joes</p> </body> </html>
he provided CSS code contains various rules related to the ::marker pseudo-element and the styling of list items, both in unordered lists (<ul>) and ordered lists (<ol>). Additionally, it includes rules for customizing markers on specific list items and using counters for ordered lists
It's important to note that not all properties can be applied to the ::marker pseudo-element, as browser support for certain styles may vary. Always check browser compatibility when using ::marker to ensure your desired styles are rendered consistently across different browsers.
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions