My post and articles

Friday, April 19, 2024

What are the essential elements of HTML?


What are the essential elements of HTML?



In the previous post about elements in HTML, we learned some tips about tags and Elements in HTML. This post will show which basic elements are essential in every web page.


The "DOCTYPE" element in HTML


The first element you'll encounter on every web page is the <!DOCTYPE html>. This element is like a secret code telling browsers about the following script's content and the HTML version. It's crucial to use the correct version, which in our case is HTML 5.2. While it's true that some older web pages may use HTML 4 or even 3, I strongly recommend using these elements in every HTML page you create.

DOCTYPE element is a single tag element with no closing tags.

HTML element



An HTML element is a couple tag element. With this element, you define where your page code starts. After the HTML opening tag, the browser interprets your web page.

Other tags and elements on your page are placed between the "html" elements tag.

head element



The "head" elements define the metadata for each web page. As you'll see in the following post, web pages are made with other script files, such as CSS style sheets, JavaScript script files, fonts, libraries, etc. Also, web pages need to use some elements and meta tags to work with search engines and crawlers. I'll publish posts about SEO in this blog.

The head elements are a couple of tag elements. Using this element is optional, but you must if you want to define title tags, style sheets, etc.


Title element

You can name your web page with a "title" element. The title element's text is displayed on your browser title bar or title tab. Each text between title tags reads as the "name" of your web page.

The title is placed before the "head" closing tag. Use of the title element is optional. However, using this tag and naming your web pages is better.

Body element


The body tag is the essential tag on your web page. What you put between the tags of the body element shows on the browser and client screen. All content, images, videos, buttons, and every element you learn here for formed content should be used between tags of the body element.

Using the body element is obligatory.

You can see a sample code of the HTML. As you see, in this example, we use all the elements described here. In the following post you'll learn more things about web programming.


<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

</body>
</html>


If you're eager to learn web programming and want to gain a practical understanding, I invite you to watch my web programming tutorial on my YouTube channel. You can also download code and other useful content from my GitHub and Telegram accounts.




No comments:

Post a Comment

Popular posts

Is marketing about "Production"?

Is marketing about "Production"? However, in marketing , we look for customers' needs and wants and want to satisfy them with ...