😆Counter Increment list, number xuongkhopbacninh.com (ok)

https://xuongkhopbacninh.com/

.wp-block-latest-posts.wp-block-latest-posts__list li {
  counter-increment: my-awesome-counter;
  position: relative;
}
.wp-block-latest-posts.wp-block-latest-posts__list li:before {
  display: inline-block;
  content: counter(my-awesome-counter);
  background-color: #008c72;
  border-radius: 50%;
  line-height: 30px;
  color: #fff;
  text-align: center;
  margin-right: 0.5rem;
  min-width: 30px;
  min-height: 30px;
  position: absolute;
  left: -15px;
  transform: translateX(-100%);
}

Ví dụ 2:

<!DOCTYPE html>
<html>
<head>
<style>
body {
  /* Set "my-sec-counter" to 0 */
  counter-reset: my-sec-counter;
}

h2::before {
  /* Increment "my-sec-counter" by 1 */
  counter-increment: my-sec-counter;
  content: "Section " counter(my-sec-counter) ". ";
}
</style>
</head>
<body>

<h2>HTML Tutorial</h2>
<h2>CSS Tutorial</h2>
<h2>JavaScript Tutorial</h2>
<h2>Bootstrap Tutorial</h2>
<h2>SQL Tutorial</h2>
<h2>PHP Tutorial</h2>

</body>
</html>

Last updated

Was this helpful?