3.1 html tag
If you are reading this text, it is assumed that in the future you will work as a Java Developer, well, or a Full Stack Java Developer. You will hardly write HTML documents, but you will have to read them often . This is how the world works, so you have to figure out how HTML documents are arranged.
What is the beginning of any HTML document? Each HTML document has a structure consisting of three nested tags:
body. This is the standard example:
<!DOCTYPE html> <html> <head> Service tags </head> <body> Main document </body> </html>
Everything that the browser displays is inside a pair tag
body(document body). Inside the tag
headare tags with service / auxiliary information for the browser.
It is also customary (optional) to write the document type at the beginning of the document -
DOCTYPEso that the parser better understands how to interpret errors. Many browsers are able to correctly display broken documents.
Or, on the contrary
XHTML = XML+HTML, there is a standard in which there are more stringent rules than in the usual one
HTML. But such information will be useful to you when you decide to write your own browser, or at least your own
3.2 The head tag
Inside the tag,
headthe following tags are usually located:
<title> specifies the name of the document that is displayed in the browser tab.
<meta>is used to set various service information. For example, you can help the browser understand the encoding of an HTML document (it contains plain text, if you remember).
<html> <head> <title> Escape character</title> <meta charset="utf-8" /> </head> <body> </body> </html>
3.3 body, p, b tags
<body>contains all the html text that will be displayed by the browser. The simplest tags for displaying a document are:
<h1>- this is a pair tag, it allows you to set the title of your page / article. If your article is long and you need subheadings, then you can use the tag for this case
<h3>and so on until
<body> <h1>Cats</h1> <h2> Description of cats</h2> detailed description of cats <h2> Origin of cats</h2> Information about the origin of cats. <h2> Cat paws</h2> Huge article about the paws of cats </body>
If your article is large and you want to make it easier to read by dividing it into paragraphs, then you will need a pair tag
<p>(from the word paragraph) for this. Just wrap the text in tags
</p>and the browser will display it as a separate paragraph.
Attention! The browser will ignore line breaks and/or extra spaces in your text. If you want to add a line break, then insert a single tag
<br>(from br eak line) into the text.
Well, the best part is highlighting the text in bold. If you want to make text bold, wrap it in tags
</b>(from b old).