What is a Web Page
When we create a web page using our webserver and sending it to a browser client we need to include the minimum amount of document structure to make it a valid web page.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>cactus.io</title> </head> <body> </body> </html>
What does it all mean?
The first line in the web page document should be <!DOCTYPE html>. This line tells the browser what type of document it is being sent. In this case it is a HTML 5 document. The html document type will still be rendered by older browsers.
The <html lang="en"> consists of a tag called html which will also have a closing tag </html>. All document content will be placed inside the opening and closing html tag. We also use lang="en" to tell the browser what primary language the document is using.
The next section is the <head> </head> section which has an opening tag <head> and closing tag </head>. This section contains information about the document. In this section we place tags such as the document title, character set, style sheets and meta data tags.
The meta tag <charset="utf-8"> is used to tell the browser that the character set that the document is encoded in. In this case it is utf-8.
The <title>cactus.io</title> tags are used to define the title of the document. It would normally be displayed in the browser page tab. In this case cactus.io would appear in the browser page tab at the top of the browser.
The main content of the document and what is displayed on the browser page is placed between the <body> and </body> tags.
What are HTML tags
HTML tags are keywords (tag names) surrounded by angle brackets. <tagname>content<tagname> Tags normally come in pairs. The first tag in a pair is the start tag, the second tag is the end tag. The end tag is written like the start tag, but with a slash before the tag name. Tags tell the browser something about how to display the document, and with tags you can also embed various media (e.g. images, video, sound) within the text. The browser does not display the tags. Usually the browser would display what is contained between the tags.
Tags can also contain attributes. The attribute would have a name followed by a = sign and then the attribute value. For example the following tags would display a text hyperlink. <a href="cactus.io">Click to go to the cactus.io website</a>.
The tags are <a></a> with an attribute called href. The href is the url the browser will go to when the user clicks on the text hyperlink.
Can I view the web page html code in the Browser
On most browsers if you right mouse click on the web page you will get a popup box. One of the options will be to view the source code of the web page. Click on that option and a browser tab will open up displaying the raw code used to generate the web page.