HTML 5 Programming and Web development/HTML 5 Elements
HTML Tags[edit | edit source]
In HTML a tag is created by putting the tag names in angle brackets like this: <Tag> The word in brackets, in this case Tag, is the Tagname. HTML 5 along with the other versions of HTML, have special tag names that we will learn about throughout this book. An example of an HTML 5 tag is b.This tag creates a bold text and it is written like this.
The output would look like this:
End Tag[edit | edit source]
An end tag is the tag that comes at the end of the element.In an end tag the element's name is preceded by a slash(/). An example of an end tag is the </b> tag used in the previous example. Reasons for using an end tag include:
- To signify the end of an element's content.
- To give the document the a good layout structure.
- To enable nested elements.
[edit | edit source]
Empty tags are tags which have no content. For example.
This tag has no content in it so therefore it is an empty tag.A more appropriate way to write an empty tag is:
By omitting the end tag and putting the slash at the end of the start tag instead. The most commonly used empty tags in HTML are:
<br/>-linebreak <hr/>-horizantal rule <input/>-HTML 5 input element. <meta/>-meta information element
The HTML Element[edit | edit source]
The HTML Element is everything from the start tag to the end tag. HTML 5 has different kinds of elements that we will learn about throughout this course.
How to write an HTML Element[edit | edit source]
To write an HTML Element we first write the start tags
<title>. Then we write the content of the Elements
My first HTML Page.Then we write the end tag.
</title>. When you put it together you have an HTML element.
<title>My first HTML 5 page</title>
Nested Elements[edit | edit source]
The content of an HTML element can be another element,when this happens it forms a nested element for example:
<head> <title>My first HTML tag</title> </head>
NB.New line character is ignored in HTML 5 So
<b> This is A multiline Line Text. </b>
Would actually render like this:
This is A multiline Line Text.
And would therefore be a single line text.To achieve multi line we actually use the line break
List of HTML 5 Elements[edit | edit source]
Note this is just a short list of elements:
Example of a well formed HTML document[edit | edit source]
<!doctype html> <html> <head> <meta charset="utf-8"/> <title>Title</title> </head> <body> <p>This is a normal Text</p> <p><b>This Is Bold text</b></p> </body> </html>
<!doctype html> is the Document type Definition which we will learn about subsequently.