HTML Element: <details>
[this page | pdf | back links]
The HTML <details> element indicates
additional details that a user can view or hide. It is new in HTML 5.
The
attributes it
can take (other than HTML global
attributes and HTML
event attributes) include:
Attribute
|
Description
|
More
|
open
|
Whether details should
be visible (i.e. open) to user
|
Here
|
To
create or access such an element in JavaScript
see here. The
corresponding HTML DOM
object supports standard
DOM properties and methods, and additional properties with the same name and
meaning as the attributes of the underlying HTML element referred to above. 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>
<details>details</details>
<br><br>Created using JavaScript:<br>
<span id="element"></span>
<script>
var x = document.createElement("DETAILS");
x.textContent = "details";
// or use var txt = document.createTextNode("details");
// x.appendChild(txt);
document.getElementById("element").appendChild(x);
</script>
</body>
</html>
|
NAVIGATION LINKS
Contents | Prev | Next | HTML Elements