Tags are normally specified in pairs, delimiting a text that will undergo some type of formatting. The tags are identified by being between the signs < > and < / >. Between the signs < > the commands themselves are specified.
In the case of tags that need to involve a text , its finalization must be done using the division bar /, indicating that the tag is finalizing the marking of a text.
Syntax
The generic format of a tag is: <tagname> text </name datag>
But some tags don't have termination. Like <img> <br> <hr>, etc.
Now let's see some tags and the kind of effect they have on text when interpreted by the browser.
Understanding a Tag
Let's understand what a tag is.
The tag <p> represents an ordinary paragraph.
Elements usually have an opening tag and an ending tag.
The opening tag contains the element name enclosed in angle brackets (<p>).
The closing tag is identical to the opening tag with the addition of a slash (/) between the opening bracket and the element name (</p>).
Content can go between these two tags:
<p> This is a single paragraph. </p>
Creating a simple page
The following HTML example creates a simple "Hello World" web page.
HTML files can be created using any text editor. Files must be saved with a .html extension to be recognized as HTML files. Once created, this file can be opened in any web browser.
<! DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Hello!</title>
</head>
<body>
<h1>Hello world!</h1>
<p>This is a simple paragraph.</p>
</body>
</html>
Simple understanding of the page we just created.
Here are the tags used in the example:
Tag | Meaning |
<!DOCTYPE> | Defines the HTML version used in the document. In this case, it's HTML5. |
<html> | Opens the page. No tagging should occur after the closing tag (</html>). The lang attribute declares the main language of the page using ISO language codes (in English).
|
<head> | Opens the main section, which does not appear in the main browser window, but mainly contains information about the HTML document, called metadata. It can also contain stylesheet and external script imports. The closing tag is </head>. |
<meta> | Provides the browser with some metadata about the document. The charset attribute declares the character encoding. Modern HTML documents should always use UTF-8, even if this is not a requirement. In HTML, the <meta> tag does not require a closing tag. |
<title> | The title of the page. Text written between this opening and the closing tag (</title>) will be displayed in the page tab or browser title bar. |
<body> | Opens the part of the document displayed to users, that is, all visible or audible content on a page. No content should be added after the closingtag </body>. |
<h1> | A level 1 header for the page. See titles for more information.
|
<p> | Represents an ordinary paragraph of text. |
Post a Comment
0Comments