What is the purpose of the contentEditable global attribute in the html element?

Asked

Viewed 518 times

2

In what actual situation or when will it be necessary to use the contentEditable global attribute, by the html element, since this is a root element and editing it would be the same as modifying, inserting or deleting the sheet elements? Example:

<html contentEditable="true">
   ...
</html>

Thank you!

1 answer

2


This means that it is possible to edit/change the content of the element.

The attribute contentEditable accepts 3 states:

  • "true" the element content can be edited.
  • "false" the content of the element nay can be edited.
  • "inherit" indicates that the state is inherited from the ancestral element that has this defined attribute.

The last case, combined with your example, makes the element content either editable or not editable depending on changing in one place (example).

More information (in English) on MDN: contentEditable

Browser other questions tagged

You are not signed in. Login or sign up in order to post.