<div class="container">
  <h3>Number of lists: </h3>
  <div contenteditable="true" id="contenteditable">
    <div>This is the editable content.</div>
  </div>
</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  inline-size: 100%;
  min-block-size: 100%;
  font-family: "Exo", system-ui, sans-serif;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 20px;
  padding: 40px;
}

.container {
  background-color: #fff;
  border: 1px solid #fff;
  border-radius: 16px;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 50px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 300px;
}

[contenteditable] {
  position: relative;
  box-sizing: border-box;
  color: deeppink;

  font-size: 1.5rem;
  width: 100%;
  font-family: "Exo", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  gap: 30px;

  counter-reset: item;
}

[contenteditable]:focus {
  outline: none;
}

[contenteditable] div {
  counter-increment: item;
}

[contenteditable] > div:first-child {
  border: 1px solid deeppink;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,
    rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
  border-radius: 5px;
  padding: 10px 16px;
}

[contenteditable]:focus > div:first-child {
  border-color: #2196f3;
  box-shadow: 0 0 0 2px #2196f3, rgba(0, 0, 0, 0.1) 0px 10px 15px -3px,
    rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
}

[contenteditable] > div:not(:first-child) {
  color: #555;
  display: flex;
  align-items: center;
}

[contenteditable] > div:not(:first-child)::before {
  content: "";
  display: inline-flex;
  width: 24px;
  height: 24px;
  border: 2px solid currentColor;
  border-radius: 50%;
  margin-right: 10px;
}

[contenteditable="true"] {
  cursor: text;
}

h3 {
  display: flex;
  align-items: center;
  gap: 20px;
}

h3::after {
  content: counter(item);
  display: inline-flex;
  padding: 5px;
  border-radius: 50%;
  background-color: deeppink;
  color: #fff;
  aspect-ratio: 1 / 1;
  justify-content: center;
  align-items: center;
  min-width: 24px;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.