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.

Advertisement

Recent Posts

Securing phpMyAdmin Like a Pro: Essential Tips and Tricks

Securing phpMyAdmin is crucial to prevent unauthorized access and protect your databases. Here's a guide…

5 months ago

Pasqal raises $100M to build a neutral atom-based quantum computer

Pasqal, a Paris-based quantum computing startup, today announced that it has raised a $100 million…

1 year ago

Apple in talks with Disney, others on VR content for new headset: Report

Developed with Sony Group Corp, the headset will have two ultra-high-resolution displays to handle the…

1 year ago

Microsoft, Amazon results to highlight softening cloud business

After years of blistering growth, most recently fuelled by remote working and studying during the…

1 year ago

Intel chairman Omar Ishrak steps down

Omar Ishrak had stepped down and the chipmaker appointed board director Frank Yeary as his…

1 year ago

Canada to commercialise world's first photonic-based quantum computer

Canadian Prime Minister Justin Trudeau has announced a new federal investment to build and commercialise…

1 year ago