Therefore, I decided to create this list to help HTML beginners like I was a few months ago to learn the basic steps for setting up a good HTML document.
1. Know the correct naming of what you are writing: in HTML, there is a specific term for each component. It might not seem so important when you are writing alone, but knowing the correct name for each thing will help you. Some of the benefits are better Google searches, improved communication with other developers, and a much more professional appearance.
Many times I had difficulty communicating with my coding partner on Microverse because I did not remember the right naming of things. Shame on me!
Here are some basic HTML terms:
– Element: an HTML element is formed by the opening tag, the content, and the closing tag. There are several types of elements, such as paragraphs, div’s, and headings. I will explain more about them later.
– Tags: an opening tag marks the beginning of the element, and consists of a less than sign (<), followed by the element’s name, and a greater than sign (>). The closing tag indicates the end of the HTML element. It has the same formation as the opening tag but has a forward slash (/) before the element’s name.
– Attributes: an attribute is a content added to the opening tag of an element and it has many uses, from providing information to changing styles. It is formed by the attribute’s name and its value. Commonly used attributes are id’s and classes.
2. Don’t forget the declaration: it should always be the first line on every HTML document. This isn’t a tag, but an instruction to the web browser about what type of document to expect, and the version of HTML the page is written in. Forgetting it may cause weird rendering of your page. The simplest and most reliable doctype declaration to use is the one defined in HTML5: .
Also, never forget to save your file with a .html extension so your OS would recognize it as an HTML document.
3. The HTML tag: although the doctype declaration informs the web browser what language your document is written in, it does not actually add any HTML structure or content. This is done by the element, which should be the second thing in your document. Every other elements from the web page should be between the opening () and closing () HTML tags.
4. Inside the : theelement is located right after the opening tag. It contains information that is not displayed directly on the web page, the metadata. It is information about the page itself, such as the document title (displayed on the title bar in the browser window), and links to external files, such as the CSS style sheet. The following tags describe metadata: