{"id":2998,"date":"2024-02-24T19:26:45","date_gmt":"2024-02-24T09:26:45","guid":{"rendered":"https:\/\/brendangasparin.com\/blog\/?p=2998"},"modified":"2025-07-30T18:28:34","modified_gmt":"2025-07-30T08:28:34","slug":"introduction-to-html-tutorial-for-beginners-2024-part-2","status":"publish","type":"post","link":"https:\/\/brendangasparin.com\/blog\/2024\/02\/24\/introduction-to-html-tutorial-for-beginners-2024-part-2\/","title":{"rendered":"Introduction to HTML Tutorial for Beginners 2024 Part 2"},"content":{"rendered":"\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/brendangasparin.com\/blog\/wp-content\/uploads\/2023\/12\/brendan-gasparin-tech-blog-logo.svg\" alt=\"Brendan Gasparin's Tech Blog logo.\" class=\"wp-image-2824\" style=\"width:500px\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-center\">Introduction to HTML Tutorial for Beginners 2024 Part 2<\/h2>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/brendangasparin.com\/blog\/wp-content\/uploads\/2024\/02\/jackson-sophat-_t-l5FFH8VA-unsplash-1024x576.jpg\" alt=\"A picture of a HTML tag.\" class=\"wp-image-3000\" style=\"width:500px\" srcset=\"https:\/\/brendangasparin.com\/blog\/wp-content\/uploads\/2024\/02\/jackson-sophat-_t-l5FFH8VA-unsplash-1024x576.jpg 1024w, https:\/\/brendangasparin.com\/blog\/wp-content\/uploads\/2024\/02\/jackson-sophat-_t-l5FFH8VA-unsplash-300x169.jpg 300w, https:\/\/brendangasparin.com\/blog\/wp-content\/uploads\/2024\/02\/jackson-sophat-_t-l5FFH8VA-unsplash-768x432.jpg 768w, https:\/\/brendangasparin.com\/blog\/wp-content\/uploads\/2024\/02\/jackson-sophat-_t-l5FFH8VA-unsplash-1536x864.jpg 1536w, https:\/\/brendangasparin.com\/blog\/wp-content\/uploads\/2024\/02\/jackson-sophat-_t-l5FFH8VA-unsplash-2048x1152.jpg 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center\">Photo by <a href=\"https:\/\/unsplash.com\/@jacksonsophat?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\">Jackson Sophat<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/orange-plastic-blocks-on-white-surface-_t-l5FFH8VA?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\">Unsplash<\/a><\/p>\n\n\n\n<p>This is part 2 of a beginner\u2019s introduction to HTML. <a href=\"https:\/\/brendangasparin.com\/blog\/2024\/02\/17\/introduction-to-html-tutorial-for-beginners-2024-part-1\/\" title=\"\">Part 1<\/a> explained the very basics of making your first HTML page.<\/p>\n\n\n\n<p>This time we will go over some of the fundamental HTML elements that web developers use to code content onto their web pages: headings, paragraphs, links, images, and lists.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Headings<\/h2>\n\n\n\n<p>In order to be interpreted by search engines (and therefore get web traffic), you should have headings in your content. There are 6 levels of headings, and their tags are numbered &lt;h1&gt; through to &lt;h6&gt;.<\/p>\n\n\n\n<p>There should only be one &lt;h1&gt; heading per page. This is your main heading. Sub-headings should be &lt;h2&gt;, sub-headings of those should be &lt;h3&gt;, and so forth.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;h1&gt;This is the page heading.&lt;\/h1&gt;\n&lt;h2&gt;This is a sub-heading.&lt;\/h2&gt;\n&lt;h2&gt;This is another sub-heading.&lt;\/h2&gt;\n&lt;h3&gt;This is a sub-heading of the h2 sub-heading.&lt;\/h3&gt;\n&lt;h3&gt;This is another sub-heading of the same h2 sub-heading.&lt;\/h3&gt;\n&lt;p&gt;This is the content that appears below the last h3 heading.&lt;\/p&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Paragraphs<\/h2>\n\n\n\n<p>The &lt;p&gt; tag is used to enclose paragraphs of text content.<\/p>\n\n\n\n<p>Like the heading element, the paragraph element is a block element. This means that by default it takes up a whole line on a web page (i.e. it starts on a new line, and so does the element that follows it).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;p&gt;This is a paragraph&lt;\/p&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Comments<\/h2>\n\n\n\n<p>Comments are messages that developers can write in the source code that will not be displayed in the web page by the browser. These might include to-do notes, browser compatibility issues, and messages for other developers looking at the code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!-- This is a comment. --&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Links and Attributes<\/h2>\n\n\n\n<p>Links, or hyperlinks, are used to link to other resources on the Internet. To tell a link where to direct the user, we must give the HTML link (or anchor) tag an attribute.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>This is a &lt;a href=\"https:\/\/mozilla.org\/\"&gt;hypertext link&lt;\/a&gt;.<\/code><\/pre>\n\n\n\n<p>HTML elements can have attributes, which are given in the opening tag. These can be used to provide additional information about the element and modify its behavior.<\/p>\n\n\n\n<p>In this case the &lt;a&gt; tag has a href element, and we are giving it a value of \u201c<a href=\"https:\/\/mozilla.org\">https:\/\/mozilla.org<\/a>\u201d by placing that in double quotes after the equals sign. That is where our link will take the user if they click on it.<\/p>\n\n\n\n<p>The content between the opening and closing tag is what will be linked in the user\u2019s browser. It will by default be underlined and colored differently from normal text.<\/p>\n\n\n\n<p>As opposed to heading and paragraph elements (block elements), a link is an inline element. This means that it does not display on its own line. It should not be on its own line or indented in the code either.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Images<\/h2>\n\n\n\n<p>The image HTML element requires two attributes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;img src=\".\/doge.jpg\" alt=\"A smiling dog.\" \/&gt;<\/code><\/pre>\n\n\n\n<p>The two necessary attributes are src and alt.<\/p>\n\n\n\n<p>The src attribute gives the location and filename of the image to display. In this case it\u2019s doge.jpg and the .\/ means it\u2019s in the same directory as this web page.<\/p>\n\n\n\n<p>The alt attribute is used for screen-readers or if the image fails to display. It should always be included for accessibility purposes, except for when the image is purely decorative.<\/p>\n\n\n\n<p>Note that the image tag is self-closing. It is a block element.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Lists and List Items<\/h2>\n\n\n\n<p>There are two types of lists in HTML.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Unordered Lists<\/h3>\n\n\n\n<p>Unordered lists are lists where the order in which the items are presented is not important or numerically quantifiable. The default presentation of an unordered list is a bullet list.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;p&gt;Subjects to learn:&lt;\/p&gt;\n&lt;ul&gt;\n  &lt;li&gt;Helicopter flying&lt;\/li&gt;\n  &lt;li&gt;Kung Fu&lt;\/li&gt;\n  &lt;li&gt;Web Design&lt;\/li&gt;\n&lt;\/ul&gt;<\/code><\/pre>\n\n\n\n<p>The &lt;ul&gt; tag is used to create the unordered list itself. Nested within are the list items, contained within &lt;li&gt; tags.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ordered Lists<\/h3>\n\n\n\n<p>Ordered lists are typically numbered and can be used to represent a series of steps, top 10 lists, to-do lists, and other ordered items. The default presentation of an ordered list is a numbered list ascending from the number 1.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;p&gt;Order of The Matrix movies:&lt;\/p&gt;\n&lt;ol&gt;\n  &lt;li&gt;The Matrix&lt;\/li&gt;\n  &lt;li&gt;The Matrix Reloaded&lt;\/li&gt;\n  &lt;li&gt;The Matrix Revolutions&lt;\/li&gt;\n  &lt;li&gt;The Matrix Resurrection&lt;\/li&gt;\n&lt;\/ol&gt;<\/code><\/pre>\n\n\n\n<p>The &lt;ol&gt; tag is used to create the ordered list. Nested within are the list items, contained within &lt;li&gt; tags.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Line Break<\/h2>\n\n\n\n<p>You can create a line break in text using the &lt;br \/&gt; tag. This is a self-closing inline element.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;p&gt;This is one line.&lt;br \/&gt;This is another line.&lt;\/p&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Horizontal Rules<\/h2>\n\n\n\n<p>You can place a horizontal rule (i.e. a line) on a page with the &lt;hr \/&gt; tag. This is a self-closing block element.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;hr \/&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Your Assignment: HTML Cookbook<\/h2>\n\n\n\n<p>Your assignment, should you choose to accept it, is to make a HTML cookbook.<\/p>\n\n\n\n<p>If you\u2019ve forgotten how to make a HTML file you can refer to <a href=\"https:\/\/brendangasparin.com\/blog\/2024\/02\/17\/introduction-to-html-tutorial-for-beginners-2024-part-1\/\" title=\"\">part 1 of this series<\/a>.<\/p>\n\n\n\n<p>It doesn\u2019t need to be a literal cookbook. It just needs to be a menu page and three more pages on related subjects that follow these rules:<\/p>\n\n\n\n<p>Each page should have headings, an image, at least one paragraph for a description, an unordered list (e.g. the ingredients), and a numbered list (e.g. the steps to follow).<\/p>\n\n\n\n<p>This uses many of the elements we\u2019ve covered. It also requires knowledge of one more thing:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Working With Multiple Files in HTML<\/h2>\n\n\n\n<p>The simplest way for us to work with multiple pages in HTML is to put all the files in the same folder. Then to call on the source URL we can just use \u201c.\/\u201d followed by the file name. e.g.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;img src=\".\/doge.jpg\" alt=\"A smiling dog.\" \/&gt;\n&lt;p&gt;This is a &lt;a href=\".\/biography.html\"&gt;good boy&lt;\/a&gt;.&lt;\/p&gt;<\/code><\/pre>\n\n\n\n<p>If we want to be more organized, we can have sub-directories within our website directory. For example, we could have an images sub-directory. Then we would display the image like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;img src=\".\/images\/doge.jpg\" alt=\"A smiling dog.\" \/&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Organizing Your Website Files<\/h2>\n\n\n\n<p>When you make your HTML cookbook, you can do it this way:<\/p>\n\n\n\n<p>Make a directory for your project. Inside, make a text file and name it \u201cindex.html\u201d. This is the default page that is loaded by a web browser if a web address is specified without a specific HTML filename.<\/p>\n\n\n\n<p>Give your menu page a &lt;h1&gt; and possibly a &lt;h2&gt; heading, and an unordered list of links to the three \u201crecipe\u201d pages you will make.<\/p>\n\n\n\n<p>Now make the recipe pages. Create three text files and give them names ending in .html extensions.<\/p>\n\n\n\n<p>As stated above, each page should have headings, an image, at least one paragraph for a description, an unordered list (e.g. the ingredients), and a numbered list (e.g. the steps to follow). It should also have a link back to the menu page.<\/p>\n\n\n\n<p>As an extra challenge, try storing the images in a sub-directory and displaying them from the parent directory, as described above.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>By this stage you should have a working recipe book using pure HTML.<\/p>\n\n\n\n<p>If this article improved your understanding of HTML and you want to see similar content then you need to <a href=\"https:\/\/brendangasparin.com\/newsletter\/\" title=\"\">sign up for my newsletter<\/a>.<\/p>\n\n\n\n<p>I wish you all the best in your journey of learning and discovery.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction to HTML Tutorial for Beginners 2024 Part 2 Photo by Jackson Sophat on Unsplash This is part 2 of a beginner\u2019s introduction to HTML. Part 1 explained the very basics of making your first HTML page. This time we will go over some of the fundamental HTML elements that web developers use to code [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2998","post","type-post","status-publish","format-standard","hentry","category-web-development"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/posts\/2998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/comments?post=2998"}],"version-history":[{"count":4,"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/posts\/2998\/revisions"}],"predecessor-version":[{"id":3196,"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/posts\/2998\/revisions\/3196"}],"wp:attachment":[{"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/media?parent=2998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/categories?post=2998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/brendangasparin.com\/blog\/wp-json\/wp\/v2\/tags?post=2998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}