HTML <b> tagS2C Home   « HTML <b> tag

Definition

The <b> tag is used for making bold text.

In almost all cases prefer other options such as the <em> element to emphasize text and the <strong> element to mark text with strong importance.

You can also use the CSS font-weight property to embolden text with a higher degree of control.

Example

<b>This text will be in bold type.</b>
This text will be in bold type.

Attributes

The following attributes can be used with the <b> tag.


<b> Specific Attributes
Attribute Value Description Example
There are no required or optional attributes specific to the <b> tag.
<b> Global Attributes
Attribute Description Example
Common
classSpecifies a classname for the element allowing you to apply the style of the predefined class to the content.

<b class="name">Bold type text here</b>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<b id="name">Bold type text here</b>
styleSpecifies an inline style for the element allowing you to apply the style to the content.

<b style="color:red;">Bold type text here</b>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<b title="Content info">Bold type text here</b>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<b accesskey="a">Bold type text here</b>
tabindexSpecifies a tab order for the element.

<b tabindex="1">Bold type text here</b>
Language
dirSpecifies the directional flow of the content.

<!-- The text will flow from left to right -->
<b dir="ltr">Bold type text here</b>
<!-- The text will flow from right to left -->
<b dir="rtl">Bold type text here</b>
langSpecifies a language code for the content of the element.

<b lang="en">Bold type text here</b>
spellcheckSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values true and false. -->
<!-- Default inherited / browser specific. -->
<b spellcheck="true">Bold type text here</b> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values yes and no. -->
<!-- Default yes. -->
<b translate="no">Bold type text here</b> 
Miscellaneous
contenteditableSpecifies whether the content of the element is editable.

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<b contenteditable="true">Bold type text here</b> 
draggableSpecifies whether the element is draggable.

<!-- Valid values true and false. -->
<!-- Default browser specific. -->
<b draggable="true">Bold type text here</b>
hiddenSpecifies whether the element is not yet, or no longer, relevant.

<!-- Valid values an empty string or hidden -->
<b hidden>Bold type text here</b> 
<b hidden="hidden">Bold type text here</b> 
<b> Event Attributes
Attribute Description Example
Document Element
oncopyThe script to be run when the user copies the content of an element.

 <!-- Executes go() function -->
<b oncopy="go()">Bold type text here</b> 
oncutThe script to be run when the user cuts the content of an element.

 <!-- Executes go() function -->
<b oncut="go()">Bold type text here</b>
onpasteThe script to be run when the user pastes some content into an element.

 <!-- Executes go() function -->
<b onpaste="go()">Bold type text here</b>
Drag and Drop
ondragThe script to be run when an element is dragged.

 <!-- Executes go() function -->
<b ondrag="go()">Bold type text here</b>
ondragendThe script to be run when an element has stopped being dragged.

 <!-- Executes go() function -->
<b ondragend="go()">Bold type text here</b>
ondragenterThe script to be run when an element has been dragged to a valid drop target.

 <!-- Executes go() function -->
<b ondragenter="go()">Bold type text here</b>
ondragleaveThe script to be run when an element leaves a valid drop target.

 <!-- Executes go() function -->
<b ondragleave="go()">Bold type text here</b>
ondragoverThe script to be run when an element is being dragged over a valid drop target.

 <!-- Executes go() function -->
<b ondragover="go()">Bold type text here</b>
ondragstartThe script to be run at the start of a drag operation.

 <!-- Executes go() function -->
<b ondragstart="go()">Bold type text here</b>
ondropThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<b ondrop="go()">Bold type text here</b>
Form
onblurThe script to be run when the element loses focus.

 <!-- Executes go() function -->
<b onblur="go()">Bold type text here</b>
onchangeThe script to be run when object changed and attempt to leave field.

 <!-- Executes go() function -->
<b onchange="go()">Bold type text here</b>
oncontextmenuThe script to be run when a context menu is triggered.

 <!-- Executes go() function -->
<b oncontextmenu="go()">Bold type text here</b>
onfocusThe script to be run when the element gets focus.

 <!-- Executes go() function -->
<b onfocus="go()">Bold type text here</b>
oninputThe script to be run when an element gets user input.

 <!-- Executes go() function -->
<b oninput="go()">Bold type text here</b>
oninvalidThe script to be run when an element is invalid.

 <!-- Executes go() function -->
<b oninvalid="go()">Bold type text here</b>
onresetThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<b onreset="go()">Bold type text here</b>
onselectThe script to be run when some or all of the contents of an object are selected.

 <!-- Executes go() function -->
<b onselect="go()">Bold type text here</b>
onsubmitThe script to be run when a form is submitted.

 <!-- Executes go() function -->
<b onsubmit="go()">Bold type text here</b>
Keyboard
onkeydownThe script to be run when an element is in focus and keyboard key is pressed down.

 <!-- Executes go() function -->
<b onkeydown="go()">Bold type text here</b>
onkeypressThe script to be run when an element is in focus and keyboard key is pressed down and released.

 <!-- Executes go() function -->
<b onkeypress="go()">Bold type text here</b>
onkeyupThe script to be run when an element is in focus and keyboard key is released.

 <!-- Executes go() function -->
<b onkeyup="go()">Bold type text here</b>
Media
onabortThe script code to be run on abort.

 <!-- Executes go() function -->
<b onabort="go()">Bold type text here</b>
oncanplayThe script to be run when a file has buffered enough so it is ready to start playing.

 <!-- Executes go() function -->
<b oncanplay="go()">Bold type text here</b>
oncanplaythroughThe script to be run when a file can be played all the way to the end without further need of buffering.

 <!-- Executes go() function -->
<b oncanplaythrough="go()">Bold type text here</b>
oncuechangeThe script to be run when the cue changes when using the track element.

 <!-- Executes go() function -->
<b oncuechange="go()">Bold type text here</b>
ondurationchangeThe script to be run when the length of the media is changed.

 <!-- Executes go() function -->
<b ondurationchange="go()">Bold type text here</b>
onemptiedThe script to be run when a media resource element suddenly becomes empty, usually due to an error.

 <!-- Executes go() function -->
<b onemptied="go()">Bold type text here</b>
onendedThe script to be run when the media has reach the end.

 <!-- Executes go() function -->
<b onended="go()">Bold type text here</b>
onloadeddataThe script to be run when media data is loaded and playback can start.

 <!-- Executes go() function -->
<b onloadeddata="go()">Bold type text here</b>
onloadedmetadataThe script to be run when metadata has been loaded.

 <!-- Executes go() function -->
<b onloadedmetadata="go()">Bold type text here</b>
onloadstartThe script to be run whenthe media resource has started loading.

 <!-- Executes go() function -->
<b onloadstart="go()">Bold type text here</b>
onpauseThe script to be run when the media resource has been paused.

 <!-- Executes go() function -->
<b onpause="go()">Bold type text here</b>
onplayThe script to be run when the media resource starts playback.

 <!-- Executes go() function -->
<b onplay="go()">Bold type text here</b>
onplayingThe script to be run when when playback has already begun.

 <!-- Executes go() function -->
<b onplaying="go()">Bold type text here</b>
onprogressThe script to be run when the browser is fetching the media data.

 <!-- Executes go() function -->
<b onprogress="go()">Bold type text here</b>
onratechangeThe script to be run when the playback rate changes.

 <!-- Executes go() function -->
<b onratechange="go()">Bold type text here</b>
onseekedThe script to be run when the seeking attribute is set to false indicating that seeking has finished.

 <!-- Executes go() function -->
<b onseeked="go()">Bold type text here</b>
onseekingThe script to be run when the seeking attribute is set to true indicating that seeking is currently active.

 <!-- Executes go() function -->
<b onseeking="go()">Bold type text here</b>
onstalledThe script to be run when the browser is unable to continue fetching media data.

 <!-- Executes go() function -->
<b onstalled="go()">Bold type text here</b>
onsuspendThe script to be run when media data has stopped before being completely loaded.

 <!-- Executes go() function -->
<b onsuspend="go()">Bold type text here</b>
ontimeupdateThe script to be run when the media resources current playback position has changed.

 <!-- Executes go() function -->
<b ontimeupdate="go()">Bold type text here</b>
onvolumechangeThe script to be run when the volume has changed or been muted.

 <!-- Executes go() function -->
<b onvolumechange="go()">Bold type text here</b>
onwaitingThe script to be run when the media resource has paused but is expected to resume.

 <!-- Executes go() function -->
<b onwaiting="go()">Bold type text here</b>
Mouse
onclickThe script to be run when when a mouse is clicked on an element.

 <!-- Executes go() function -->
<b onclick="go()">Bold type text here</b>
ondblclickThe script to be run when a mouse is double clicked on an element.

 <!-- Executes go() function -->
<b ondblclick="go()">Bold type text here</b>
onmousedownThe script to be run when he mouse button is pressed down while the cursor is over an element.

 <!-- Executes go() function -->
<b onmousedown="go()">Bold type text here</b>
onmousemoveThe script to be run when the mouse button is moved.

 <!-- Executes go() function -->
<b onmousemove="go()">Bold type text here</b>
onmouseoutThe script to be run when the mouse cursor moves off an element.

 <!-- Executes go() function -->
<b onmouseout="go()">Bold type text here</b>
onmouseoverThe script to be run when the mouse cursor moves over an element.

 <!-- Executes go() function -->
<b onmouseover="go()">Bold type text here</b>
onmouseupThe script to be run when the mouse button is released while the cursor is over the element.

 <!-- Executes go() function -->
<b onmouseup="go()">Bold type text here</b>
onwheelThe script to be run when the mouse wheel rolls up or down over an element.

 <!-- Executes go() function -->
<b onwheel="go()">Bold type text here</b>
Scroll
onscrollThe script code to be run when the scrollbar of an element is being scrolled.

 <!-- Executes go() function -->
<b onscroll="go()">Bold type text here</b> 
Window - NONE

Relevant HTML Tutorials

HTML Basics - Text Tags