HTML accesskey attribute
In this tutorial, we will learn about accesskey attribute in HTML with the help of examples.
accesskey attribute
The accesskey attribute specifies a shortcut key to activate/focus an tag.
Note : The accesskey attribute value must be single character(a digit or a letter).
Syntax
<a accesskey = "character">......</a>
Attribute values
Value | Description |
---|---|
character | A single character that specifies the shortcut key to activate/focus the tag |
HTML class attribute
In this tutorial, we will learn about class attribute in HTML with the help of examples.
class attribute
The class attribute is used to specify one or more classnames for a tag.
Note : The class attribute is mostly used to point to a class in a stylesheet and used by a Javascript to target the elements with the specified class name.
Syntax
<a class = "newLink">......</a>
Attribute values
Value | Description |
---|---|
className | Used to specify one or more class names for an element |
Note : To specify multiple classes we have to separate the class names with a space.
Class Naming Rules
Naming rules to specify class name :
- Must contain at least one character
- Must begin with a letter A-Z or a-z
- Can be followed by : letters(A-Z, a-z), digit(0-9), hypens(“-“), and underscore(“_”)
- Must not contain any space characters
HTML contenteditable attribute
In this tutorial, we will learn about contenteditable attribute in HTML with the help of examples.
contenteditable attribute
The contenteditable attribute is used to specify whether the content of an element is editable or not.
Syntax
<a contenteditable = "true">......</a>
Attribute values
Value | Description |
---|---|
true | Used to specify that the element is editable |
false | Used to specify that the element is not editable |
HTML data attribute
In this tutorial, we will learn about data attribute in HTML with the help of examples.
data attribute
The data-* attribute is used to store custom data private to the page or application and gives us the ability to embed custom data attributes on all HTML tags.
The data-* attributes mainly consists of two parts :
- There must be at least one character long after the prefix data-.
- The attribute name should not contain any uppercase letters.
- The attribute value can be any string.
Syntax
<a data-* = "mydata">......</a>
Attribute values
Value | Description |
---|---|
someStringValue | Used to specify the value of the attribute(as a string) |
HTML dir attribute
In this tutorial, we will learn about dir attribute in HTML with the help of examples.
dir attribute
The dir attribute is used to specify the text direction of the element’s content.
Syntax
<a dir = "rtl">......</a>
Attribute values
Value | Description |
---|---|
ltr | Default.Used to define the text direction from left-to-right direction |
rtl | Used to define the text direction from right-to-left direction |
auto | Used to define the direction based on the content |
HTML draggable attribute
In this tutorial, we will learn about draggable attribute in HTML with the help of examples.
draggable attribute
The draggable attribute is used to specify whether an element is draggable or not.
Syntax
<a draggable = "true">......</a>
Attribute values
Value | Description |
---|---|
true | Used to specify that the element is draggable |
false | Used to specify that the element is not draggable |
auto | Used the default browser behaviour of the browser |
HTML hidden attribute
In this tutorial, we will learn about hidden attribute in HTML with the help of examples.
hidden attribute
The hidden attribute is a boolean attribute and specifies that an element is not yet, or no longer, relevent.
Note : We can use hidden attribute until some condition has been met. Then, we remove the hidden attribute with Javascript, and make the element visible.
Syntax
<a hidden>......</a>
HTML id attribute
In this tutorial, we will learn about id attribute in HTML with the help of examples.
id attribute
The id attribute is used to specify a unique id for an HTML element. The value in id attribute ,must be unique within the HTML document.
Note : We can use id attribute is used in Javscript,stylesheet to target an HTML tag with the specific id.
Syntax
<a id = "MyId">......</a>
Attribute values
Value | Description |
---|---|
id | Used to specify a unique id for the element |
Id Naming Rules
Naming rules to specify id :
- Must contain at least one character
- Must begin with a letter A-Z or a-z
- Can be followed by : letters(A-Z, a-z), digit(0-9), hypens(“-“), and underscore(“_”)
- Must not contain any space characters
HTML lang attribute
In this tutorial, we will learn about lang attribute in HTML with the help of examples.
lang attribute
The lang attribute is used to specify the language of the element’s content by using language code.
Example of some language codes – en for english, fr for french, es for spanish and so on.
Syntax
<a lang = "language_code">......</a>
Attribute values
Value | Description |
---|---|
language_code | Used to specify the language code for the element’s content |
HTML spellcheck attribute
In this tutorial, we will learn about spellcheck attribute in HTML with the help of examples.
spellcheck attribute
The spellcheck attribute is used to specify whether the tag have its spelling and grammar checked or not.
Different text that can be spellchecked :
- Text in editable tags
- Text values in input elements(not password)
- Text in <textarea> tag
Syntax
<a spellcheck = "true">......</a>
Attribute values
Value | Description |
---|---|
true | Used to check spelling and grammar |
false | Used to not check spelling and grammar |
HTML style attribute
In this tutorial, we will learn about style attribute in HTML with the help of examples.
style attribute
The style attribute is used to specify inline style for an element.
Note : The style attribute will automatically override any style set globally i.e. inside <style> tag or in an external stylesheet.
Syntax
<a style = "border:2px solid red;">......</a>
Attribute values
Value | Description |
---|---|
style_definations | One or more CSS properties and values separated by semicolons |
HTML tabindex attribute
In this tutorial, we will learn about tabindex attribute in HTML with the help of examples.
tabindex attribute
The tabindex attribute is used to specify the tab order of an element.
Syntax
<a tabindex = "number">......</a>
Attribute values
Value | Description |
---|---|
number | It is used to specify the tabbing order of the element |
HTML title attribute
In this tutorial, we will learn about title attribute in HTML with the help of examples.
title attribute
The title attribute is used to specify extra information about an element when the mouse moves over the element.
Syntax
<a title = "text">......</a>
Attribute values
Value | Description |
---|---|
text | A tooltip text for an element |
HTML translate attribute
In this tutorial, we will learn about translate attribute in HTML with the help of examples.
translate attribute
The translate attribute is used to specify whether the content of an element should be translated or not.
Note : We would recommend you to not use the translate attribute because it is not supported in most of the browsers.
Syntax
<a translate = "yes">......</a>
Attribute values
Value | Description |
---|---|
yes | Used to specify that the content of the element should be translated |
no | Used to specify that the content of the element must not be translated |