Docs › Text and paragraphs
Bold, italic, underline
Bold, italic, underline, strikethrough, sub/superscript, inline code.
The basic text format buttons. Select text and press one, or press it first and keep typing. Press again to turn it off.
Try it
Bold, italic, underline, strikethrough, H2O, 103, npm install
Code for this demo
createEditor('#editor', {
toolbar: 'bold italic underline strike | subscript superscript code',
});Buttons and shortcuts
| Toolbar name | Format | Shortcut | Saved as |
|---|---|---|---|
bold | Bold | Ctrl+B | <strong> |
italic | Italic | Ctrl+I | <em> |
underline | Underline | Ctrl+U | <u> |
strike | Strikethrough | Ctrl+Shift+X | <s> |
subscript | Subscript | Ctrl+, | <sub> |
superscript | Superscript | Ctrl+. | <sup> |
code | Inline code | Ctrl+E | <code> |
On macOS use ⌘. Buttons show as pressed when the caret is inside that format. Pressing code inside inline code removes it.
Markdown-style typing works too: **bold**, *italic*, ~~strike~~, `code` (Markdown input).
Presets and the selection toolbar
board(default): bold, underline, strikethrough on the first row; italic and sub/superscript under ⋯ more. No inline code.full: bold, italic, underline, strikethrough on the first row; sub/superscript and inline code under morebasic: bold, italic, underline, strikethrough.minimal: bold, italic, underline- On phones only bold is on the main row; the rest is under ⋯.
The toolbar that pops up over a selection (bubble toolbar) also has bold, italic, underline, strikethrough and inline code, even when the main toolbar doesn't.
Saved HTML
Browser-made <b>, <i> and <strike> are saved as <strong>, <em> and <s>.
<p><strong>Bold</strong>, <em>italic</em>, <u>underline</u>, <s>strikethrough</s>, H<sub>2</sub>O, <code>npm install</code></p>API
editor.exec('bold');
editor.queryState('bold'); // true when the caret is in bold textOptions
| Name | Type | Default | Description |
|---|---|---|---|
bold italic underline strike | toolbar item | — | Bold, italic, underline, strikethrough |
subscript superscript | toolbar item | — | Subscript, superscript |
code | toolbar item | — | Inline code (multi-line: code blocks) |
bubbleToolbar | boolean | true | Format toolbar over a selection |
markdownShortcuts | boolean | true | Typing rules such as **bold** |