<div class="container">
  <p contenteditable="true">Element is editable</p>
</div>

<div class="container">
  <p contenteditable="false">Element is NOT editable</p>
</div>

<div class="container">
  <p contenteditable="inherit">Element inherits its parent's editable status</p>
</div>

<div class="container">
  <p>There is no element that explicitly sets the contenteditable attribute.</p>
</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: 8px;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 10px 50px;
  padding: 10px;
  display: flex;
}

[contenteditable],
p {
  position: relative;
  display: flex;
  box-sizing: border-box;
  color: deeppink;
  border-radius: 5px;
  padding: 10px 16px;
  min-height: 60px;
  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;
  font-size: 1.5rem;
  width: 100%;
  font-family: "Exo", system-ui, sans-serif;
}

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

[contenteditable="false"] {
  cursor: not-allowed;
  filter: grayscale(1);
}

[contenteditable="inherit"] {
  cursor: inherit;
}
const pElements = document.querySelectorAll("p");

pElements.forEach((p, index) => {
  console.log(`p[${index}](contentEditable):`, p.contentEditable);
  console.log(`p[${index}](isContentEditable):`, p.isContentEditable);

  p.addEventListener("input", (etv) => {
    alert(etv.target.textContent);
  });
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.