Skip to content

Instantly share code, notes, and snippets.

@rubinchyk
Last active September 28, 2024 20:46
Show Gist options
  • Select an option

  • Save rubinchyk/58fb48931edd8dd0e2ea44c825ee66a5 to your computer and use it in GitHub Desktop.

Select an option

Save rubinchyk/58fb48931edd8dd0e2ea44c825ee66a5 to your computer and use it in GitHub Desktop.
[Counters using css] Counter implementation using regular css #css
<!DOCTYPE html>
<html>
<head>
<style>
body {
counter-reset: section;
}
h2::before {
counter-increment: section;
content: "Section " counter(section) ": ";
}
</style>
</head>
<body>
<h1>Using CSS Counters:</h1>
<h2>HTML Tutorial</h2>
<h2>CSS Tutorial</h2>
<h2>JavaScript Tutorial</h2>
<p><b>Note:</b> IE8 supports these properties only if a !DOCTYPE is specified.</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment