We published our Copyright, Terms of Services and Privacy Policy in our website to secure our rights. Please access them and read them from the footer.
Make sure to enter our WhatsApp community for unpublished resources and updates!
HTML (HyperText Markup Language) is the standard language for creating websites. It structures the content you see in web browsers.
Here’s the basic structure of an HTML document:
1<!DOCTYPE >
2<html>
3<head>
4 <title>My First HTML Page</title>
5</head>
6<body>
7 <h1>Welcome to HTML</h1>
8 <p>This is my first HTML page!</p>
9</body>
10</html>
<!DOCTYPE html>
: This tells the browser we’re using HTML5.<html>
: This starts the HTML document.The Head Section
<head>
: Contains information about the page that isn’t displayed directly.<title>
: Sets the title of the page, which appears in the browser tab.The Body Section
<body>
: This contains everything that will be shown on the web page.<h1>
: This makes the text inside it a heading, which is bigger than regular text. It’s used for main titles.<p>
: This defines a paragraph, creating a block of text.Closing Tags
When you see something like </h1>
, it’s called a closing tag. It tells the browser that the heading section has ended. Every opening tag (like <h1>
) needs a closing tag (like </h1>
) to show where the element finishes. This helps keep everything organized and allows the browser to understand how to display the content.
.html
extension (e.g., index.html
).Headings are important for organizing content on your web page. HTML provides six levels of headings, from <h1>
(largest) to <h6>
(smallest).
Here’s an example:
1<h1>Main Title</h1>
2<h2>Subheading</h2>
3<h3>Section Title</h3>
4<p>This is a paragraph under a section.</p>
As mentioned before, paragraphs are created using the <p>
tag.
Example:
1<p>This is a paragraph. It can contain text that is grouped together.</p>
You can create clickable links using the <a>
tag.
Example:
1<a href="https://www.example.com">Visit Example</a>
href
attribute specifies the URL you want to link to. When clicked, it takes the user to that page.To add images, use the <img>
tag. Here’s how to use the src
attribute:
1<img src="image.jpg" alt="Description of image">
src
Attribute: This tells the browser where to find the image file.image.jpg
).images/image.jpg
).https://www.example.com/image.jpg
).Where to Place Images
images
) for better organization.src
attribute matches the location of your image.my_website/
├── index.html
└── images/
└── image.jpg
In your HTML file, you would reference the image like this:
1<img src="images/image.jpg" alt="Description of image">
You can create ordered (numbered) or unordered (bulleted) lists.
Unordered List Example:
1<ul>
2 <li>Item 1</li>
3 <li>Item 2</li>
4 <li>Item 3</li>
5</ul>
1<ol>
2 <li>First Item</li>
3 <li>Second Item</li>
4 <li>Third Item</li>
5</ol>
<body>
section.Attributes provide additional information about HTML elements. They are included in the opening tag as name/value pairs.
Example:
1<a href="https://www.example.com" target="_blank">Visit Example</a>
href
: The URL the link points to.target
: Specifies where to open the linked document. _blank
opens it in a new tab.alt
AttributeThe alt
attribute is crucial for images. It provides a text description that appears if the image fails to load and is read by screen readers for accessibility.
Example:
1<img src="image.jpg" alt="A beautiful landscape">
You can apply styles directly to an element using the style
attribute, which changes how the element looks.
Example:
1<p style="color: blue; font-size: 20px;">This is a blue paragraph with a larger font size.</p>
color
: Changes the text color.font-size
: Changes the size of the text.
While HTML allows you to add basic styling with the style
attribute, using CSS (Cascading Style Sheets) is a much more efficient way to handle design across your entire website. CSS helps you apply consistent styles to multiple elements and manage changes easily. If you're interested, we also have a dedicated course on CSS for more advanced styling techniques!
Tables help organize data into rows and columns. In HTML, the <table>
tag creates a table, and you can define the content with rows and cells.
Here’s how you create a simple table with headers and rows:
1<table>
2 <tr>
3 <th>Header 1</th>
4 <th>Header 2</th>
5 </tr>
6 <tr>
7 <td>Row 1, Column 1</td>
8 <td>Row 1, Column 2</td>
9 </tr>
10 <tr>
11 <td>Row 2, Column 1</td>
12 <td>Row 2, Column 2</td>
13 </tr>
14</table>
<table>
: Defines the table.<tr>
: Creates a row.<th>
: Creates a header cell.<td>
: Creates a standard data cell.You can add as many rows and columns as needed by simply adding more <tr>
and <td>
tags. Here's an example with more rows:
1<table>
2 <tr>
3 <th>Name</th>
4 <th>Age</th>
5 </tr>
6 <tr>
7 <td>Alice</td>
8 <td>25</td>
9 </tr>
10 <tr>
11 <td>Bob</td>
12 <td>30</td>
13 </tr>
14</table>
By default, tables don't have visible borders. You can add a basic border by using the border
attribute.
1<table border="1">
2 <tr>
3 <th>Name</th>
4 <th>Age</th>
5 </tr>
6 <tr>
7 <td>Alice</td>
8 <td>25</td>
9 </tr>
10 <tr>
11 <td>Bob</td>
12 <td>30</td>
13 </tr>
14</table>
This will create borders around the cells.
Divs and sections are essential for structuring your HTML document and organizing content visually.
<div>
ElementsThe <div>
tag is a generic container for grouping content. It doesn’t have any specific meaning but is useful for styling and layout purposes.
Example:
1<div>
2 <h2>Welcome</h2>
3 <p>This is a section of content within a div.</p>
4</div>
You can apply CSS styles to divs to control layout and presentation. (We have a separate course for CSS to design your very own modern website).
<section>
ElementsThe <section>
tag is used to define sections of related content. Each section should ideally have a heading (<h1>
to <h6>
), which makes it more semantic.
Example:
1<section>
2 <h2>About Us</h2>
3 <p>We are a technology company focused on innovation.</p>
4</section>
<div>
and <section>
<section>
has semantic meaning, indicating a thematic grouping of content, while <div>
is purely a styling container.<div>
for generic grouping of elements when there’s no specific meaning to the group.<section>
when you want to define a related block of content, particularly when it includes a heading.An iframe (inline frame) allows you to embed another webpage within your current webpage. It’s like inserting one website into another.
Here’s how you can embed another page or website using an iframe:
1<iframe src="https://www.example.com" width="600" height="400"></iframe>
src
: The URL of the page you want to embed.width
and height
: These specify the size of the iframe.Iframes are often used to embed videos, maps, or other external resources. For example, you can embed a Google map:
1<iframe src="https://maps.google.com/maps..." width="600"
2height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
When embedding iframes from external sources, it’s important to be cautious since iframes can sometimes be used for malicious purposes. Make sure the source you are embedding is trusted.