Stylization of numerical lists ol through ::before. HTML + C... open

Stylization of numerical lists ol through ::before. HTML + CSS Example

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators

Create a basic numbered list on HTML:


<ol>
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li>
</ol>

Аdd styles:


ol {
  counter-reset: ol-numbers;
}

ol li {
  position: relative;
  padding: 0px 0px 0px 50px;
}

ol li::before {
  counter-increment: ol-numbers;
  content: counter(ol-numbers) ")";
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  text-align: right; 
  color: red;
}

0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation