HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> p { counter-increment: myCounter; } p::before{ content: "Paragraph " counter(myCounter) ": "; font-weight:bold; font-size:17px; } </style> </head> <body> <h1>CSS counter-increment Property</h1> <p>This is paragraph</p> <p>This is paragraph</p> <p>This is paragraph</p> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("p")[1]; function myFunction(){ x.style.counterIncrement = "myNewCounter"; } </script> <p><strong>Note</strong>: Click on the button to set the 'counter-increment' from the second paragraph.</p> </body> </html>
OUTPUT
×

Save as Private