Thursday, November 13, 2014

HTML 5 Basic

Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>

<body>
Content of the document......
</body>

</html>
 
 The default character encoding in HTML5 is UTF-8. 
 

Adding New Elements to HTML

Example:
 
You can add any new element to HTML with a browser trick:
This example adds a new element called <myHero> to HTML, and defines a display style for it:

<!DOCTYPE html>
<html>

<head>
  <title>Creating an HTML Element</title>
  <script>document.createElement("myHero")</script>
  <style>
  myHero {
    display: block;
    background-color: #ddd;
    padding: 50px;
    font-size: 30px;
  }
  </style>
</head>

<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

<myHero>My First Hero</myHero>

</body>
</html>

 

No comments:

Post a Comment