HTML

Chapter 37: Global Attributes

AttributeDescription
classDefines one or more class names for an element. See Classes and IDs.
contenteditableSets whether the content of an element can be edited.
contextmenuDefines a context menu shown when a user right-clicks an element.
dirSets the text direction for text within an element.
draggableSets whether an element can be dragged.
hiddenHides an element not currently in use on the page.
idDefines a unique identifier for an element. See Classes and IDs.
langDefines the language of an element’s content and its text attribute values. See Content
Languages.
spellcheckSets whether to spell/grammar check the content of an element.
styleDefines a set of inline CSS styles for an element.
tabindexSets the order in which elements on a page are navigated by the tab keyboard shortcut.
titleDefines additional information about an element, generally in the form of tooltip text on
mouseover.
translateDefines whether to translate the content of an element.

Contenteditable Attribute

<p contenteditable>This is an editable paragraph.</p>

Upon clicking on the paragraph, the content of it can be edited similar to an input text field.

When the contenteditable attribute is not set on an element, the element will inherit it from its parent. So all child
text of a content editable element will also be editable, but you can turn it off for specific text, like so:

<p contenteditable>
 This is an editable paragraph.
 <span >But not this.</span>
</p>

Note that an uneditable text element inside an editable element will still have a text cursor as inherited from its
parent as well.

Recent Posts

Unlocking the Secrets of JSON.stringify(): More Than Meets the Eye

JSON (JavaScript Object Notation) is a lightweight data-interchange format widely used in web development. At…

2 months ago

How to Handle AJAX GET/POST Requests in WordPress

AJAX (Asynchronous JavaScript and XML) is a powerful technique used in modern web development that…

3 months ago

Page Speed Optimization: Post-Optimization Dos and Don’ts

Introduction After successfully optimizing your website for speed, it's essential to maintain and build upon…

3 months ago

Ultimate Guide to Securing WordPress Folders: Protect Your Site from Unauthorized Access

Securing your WordPress folders is crucial to safeguarding your website from unauthorized access and potential…

4 months ago

HTML CSS PHP File Upload With Circle Progress Bar

Creating a file upload feature with a circular progress bar involves multiple steps. You'll need…

4 months ago

Using WP Rocket with AWS CloudFront CDN

Integrating WP Rocket with AWS CloudFront CDN helps to optimize and deliver your website content…

4 months ago