FULL STACK   ·   UI   ·   UX   ·   GRAPHICS   ·   DEVELOPER   ·   INSTRUCTOR

Adam Khoury

Donate funds to show love and support

Click the button below to donate funds securely online. You can use your PayPal account or a credit card.

Your donations help free up my time to produce more content and assist in covering server costs. It's also a great way to say thanks for the content!

Application Configuration

Adam will be adding options here soon.

Automatic Numbering Tutorial Element Counter

Published :
Author :
Adam Khoury
In this CSS lesson we will demonstrate automatic numbering of web page elements using the ::before selector, and a counter function. The counter-reset and counter-increment properties give us the logic needed to created numbered sections with subsections. <style> h1 { counter-reset: section; } h2 { counter-reset: subsection; } h2::before { content: counter(section) ". "; counter-increment: section; } p::before { content: counter(section) "." counter(subsection) " "; counter-increment: subsection; } </style> <h1>HTML</h1> <h2>HTML Multimedia Elements</h2> <p>audio</p> <p>embed</p> <p>video</p> <h2>HTML Form Elements</h2> <p>form</p> <p>input</p> <p>textarea</p> <p>button</p>