HTML5 Browser Support: Add New Elements to HTML
Add New Elements to HTML
//this example adds a new element called <myHero> to an HTML page,
//and defines a style for it:
<!DOCTYPE html>
<html>
<head>
<script>document.createElement("myHero")</script>
<style>
myHero {
display: block;
background-color: #dddddd;
padding: 50px;
font-size: 30px;
}
</style>
</head>
<body>
<h1>A Heading</h1>
<myHero>My Hero Element</myHero>
</body>
</html>
You can also add new elements to an HTML page with a browser trick.
The JavaScript statement document.createElement("myHero") is needed to create a new element in IE 9, and earlier.