This chapter we will learn the basics of HTML and how to structure content on a web page using HTML tags and attributes.
An HTML document is a file that contains HTML code and is used to create web pages. It typically includes the structure, content, and formatting of a web page, and can be viewed in a web browser.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Heading1</h1>
<p>Paragraph.</p>
</body>
</html>
HTML headings are denoted by the <h1> to <h6> tags, with <h1> being the most important and <h6> being the least important. Headings help to make content more readable and organized by providing a clear structure to the page.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Heading-Only Web Page</title>
</head>
<body>
<h1>Main Heading</h1>
<h2>Subheading 1</h2>
<h3>Sub-subheading 1.1</h3>
<h4>Sub-sub-subheading 1.2</h4>
<h5>Sub-sub-subheading 1.3</h5>
<h6>Sub-subheading 1.4</h6>
</body>
</html>
HTML paragraphs are created with the <p> tag and are used to group together one or more sentences or blocks of text.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Paragraph Example</title>
</head>
<body>
<p>This is an example paragraph.</p>
<p>Here is another paragraph.</p>
</body>
</html>
HTML links are created with the <a> tag to connect web pages or resources. They allow navigation between pages and access to external content. The </a> closing tag is required!
Example
<!DOCTYPE html>
<html lang="en">
<head>
<title>Lets coding links</title>
</head>
<body>
<a href="https://www.lets-coding.com">Visit Example</a>
</body>
</html>
HTML images are inserted with the <img /> tag to display visual content. They require the src attribute to specify the image source and can include optional attributes for customization.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Lets coding</title>
</head>
<body>
<img src="/images/common/cutecat.png" alt="Description of the image" width="300" height="200">
</body>
</html>