/

HTML / CSS / JavaScript Tutorial

HTML Element: <abbr>

[this page | pdf | back links]

The HTML <abbr> element indicates an abbreviation or acronym. The full text which is being abbreviated can be included in the element’s title attribute and it will then typically appear as tooltip text if the mouse is moved over the element.

 

The attributes it can take are HTML global attributes and HTML event attributes.

 

To create or access such an element in JavaScript see here. The corresponding HTML DOM object supports standard DOM properties and methods. The default style applicable to this element is shown here.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<abbr title="MyText">abc = def</abbr>

<br><br>Created using JavaScript:<br>
<span id="element"></span>

<script>
var x = document.createElement("ABBR");
x.title = "MyText"; // or use x.setAttribute("title", "MyText");
x.textContent = "abc = def";
// or use var txt = document.createTextNode("abc = def");
// x.appendChild(txt);
document.getElementById("element").appendChild(x);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Elements


Desktop view | Switch to Mobile