AltSchool Of Engineering Tinyuka’24 Month 1 Week 3
We kicked of the class with a revision of the previous class, talking about files and folder management and why it is important, creating folders on Mac, Windows and Linux, leveraging chart GPT for problem solving, installing git and many others. You can go through the previous class here With that out of the way, here is what our instructor touched on this week. Introduction to HTML HTML, or HyperText Markup Language, is the standard markup language used to create and structure content on the web. It serves as the backbone of most websites, providing the essential framework for web pages. 1. Structure of HTML HTML consists of a series of elements, or tags, that define the different parts of a web page. These tags are enclosed in angle brackets and usually come in pairs: an opening tag and a closing tag. For example: This is a paragraph. In this example, is the opening tag, and is the closing tag. 2. Basic Components Elements: The building blocks of HTML, such as headings ( to ), paragraphs (), links (), images (), and lists (, ). Attributes: Additional information about an element, specified in the opening tag. For example, Visit Example includes the href attribute that defines the link's destination. 3. HTML Document Structure A typical HTML document starts with a declaration and includes the following sections: My Web Page Welcome to My Web Page This is a simple HTML document. : The root element of an HTML page. : Contains meta-information about the document, such as the title and links to stylesheets. : Contains the content that is displayed on the web page. 4. Importance of HTML HTML is fundamental for web development, as it allows developers to create structured content that can be styled with CSS (Cascading Style Sheets) and made interactive with JavaScript. Understanding HTML is essential for anyone looking to build websites or web applications. HTML is the cornerstone of web design, enabling the creation of structured and accessible content. By learning HTML, you gain the ability to build and understand web pages, laying the foundation for more advanced web development skills. Breaking it down a bit HTML, or HyperText Markup Language, serves as the backbone of web content by using "markup" to annotate text, images, and various media for display in web browsers. This markup consists of elements or tags, such as , , , , , , and many others. For instance, the tag is used to define paragraphs, while is used to embed images. The term "HyperText" refers to the ability of text on a web page to include references to other web pages, commonly known as hyperlinks. These links allow users to navigate seamlessly between different sections of the same page, switch to other pages within the same site, or even open completely different websites. Hyperlinks can also direct users to various formats like PDFs, emails, or multimedia files (e.g., videos and audio). This capability to link information revolutionized the web, enabling users to access a vast array of information globally and in any desired sequence. Together, HTML and the internet empower users to explore and connect with content in an organized manner. Lastly, the "Language" aspect of HTML signifies its unique syntax and structure, categorizing it as a markup language. Just like any language, it has rules and conventions that must be followed to create well-structured web pages. Understanding HTML is crucial for anyone looking to engage in web development or design. HTML Element An HTML element, often referred to as a "tag," consists of the element name enclosed within angle brackets, such as . The naming of these elements is case-insensitive, meaning you can write them in uppercase, lowercase, or a combination of both. For instance, the tag can also be represented as , , or any variation thereof. However, it is a widely accepted convention to use lowercase for tags for consistency and readability. HTML elements can be categorized into two types: self-closing tags and standard tags. Self-closing tags do not require a closing counterpart; an example is the tag, which is used to embed images. In contrast, standard tags have both an opening and a closing tag, such as for paragraphs, which is closed with . This distinction is essential for properly structuring HTML documents and ensuring that web browsers render content correctly. Creating HTML Document To create your first HTML document, start by setting up a dedicated folder for your project. Inside this folder, create a file named index.html. You can do this using Visual Studio Code, the terminal, or even a file explorer. Once you've created the file, utilize the Live Server extension in VS Code to preview your work in a web browser. This extension allows you to see real-time updates as you make changes to your HTML. It's important to ensure that you open Visual Studio Code directly in the folder you cre
We kicked of the class with a revision of the previous class, talking about files and folder management and why it is important, creating folders on Mac, Windows and Linux, leveraging chart GPT for problem solving, installing git and many others. You can go through the previous class here With that out of the way, here is what our instructor touched on this week.
Introduction to HTML
HTML, or HyperText Markup Language, is the standard markup language used to create and structure content on the web. It serves as the backbone of most websites, providing the essential framework for web pages.
1. Structure of HTML
HTML consists of a series of elements, or tags, that define the different parts of a web page. These tags are enclosed in angle brackets and usually come in pairs: an opening tag and a closing tag. For example:
This is a paragraph.
In this example, is the opening tag, and
is the closing tag.
2. Basic Components
Elements: The building blocks of HTML, such as headings (
to
), paragraphs (
), links (
), images (
), and lists (
,
).Attributes: Additional information about an element, specified in the opening tag. For example,
Visit Example
includes the href attribute that defines the link's destination.
3. HTML Document Structure
A typical HTML document starts with a declaration and includes the following sections:
My Web Page
Welcome to My Web Page
This is a simple HTML document.
: The root element of an HTML page.
: Contains meta-information about the document, such as the title and links to stylesheets.
: Contains the content that is displayed on the web page.
4. Importance of HTML
HTML is fundamental for web development, as it allows developers to create structured content that can be styled with CSS (Cascading Style Sheets) and made interactive with JavaScript. Understanding HTML is essential for anyone looking to build websites or web applications.
HTML is the cornerstone of web design, enabling the creation of structured and accessible content. By learning HTML, you gain the ability to build and understand web pages, laying the foundation for more advanced web development skills.
Breaking it down a bit
HTML, or HyperText Markup Language, serves as the backbone of web content by using "markup" to annotate text, images, and various media for display in web browsers. This markup consists of elements or tags, such as ,
, ,
, ,
, and many others. For instance, the
tag is used to define paragraphs, while
is used to embed images.
The term "HyperText" refers to the ability of text on a web page to include references to other web pages, commonly known as hyperlinks. These links allow users to navigate seamlessly between different sections of the same page, switch to other pages within the same site, or even open completely different websites. Hyperlinks can also direct users to various formats like PDFs, emails, or multimedia files (e.g., videos and audio).
This capability to link information revolutionized the web, enabling users to access a vast array of information globally and in any desired sequence. Together, HTML and the internet empower users to explore and connect with content in an organized manner.
Lastly, the "Language" aspect of HTML signifies its unique syntax and structure, categorizing it as a markup language. Just like any language, it has rules and conventions that must be followed to create well-structured web pages. Understanding HTML is crucial for anyone looking to engage in web development or design.
HTML Element
An HTML element, often referred to as a "tag," consists of the element name enclosed within angle brackets, such as . The naming of these elements is case-insensitive, meaning you can write them in uppercase, lowercase, or a combination of both. For instance, the
tag can also be represented as
,
, or any variation thereof. However, it is a widely accepted convention to use lowercase for tags for consistency and readability.
HTML elements can be categorized into two types: self-closing tags and standard tags. Self-closing tags do not require a closing counterpart; an example is the
tag, which is used to embed images. In contrast, standard tags have both an opening and a closing tag, such as for paragraphs, which is closed with
. This distinction is essential for properly structuring HTML documents and ensuring that web browsers render content correctly.
Creating HTML Document
To create your first HTML document, start by setting up a dedicated folder for your project. Inside this folder, create a file named index.html. You can do this using Visual Studio Code, the terminal, or even a file explorer.
Once you've created the file, utilize the Live Server extension in VS Code to preview your work in a web browser. This extension allows you to see real-time updates as you make changes to your HTML.
It's important to ensure that you open Visual Studio Code directly in the folder you created for your project. Avoid opening it from broader locations like your computer's root directory, desktop, or downloads folder, as this can lead to confusion and disorganization in managing your files. By keeping everything organized in one folder, you’ll streamline your workflow and make development easier.
Responsive Web Page
Welcome to the world of HTML
The Doctype Declaration
To begin an HTML document, it's essential to include the declaration at the very top. While this may resemble an HTML element due to its tag-like structure, it is actually a special node known as a declaration. This declaration instructs the web browser to render the page in standards mode, ensuring consistent and reliable behaviour across different browsers.
If you omit the declaration, the browser may default to quirks mode, which can lead to inconsistent rendering and unexpected behaviour. By including the DOCTYPE, you set a clear standard for how the document should be interpreted, promoting better compatibility and adherence to modern HTML standards.
HTML
The element serves as the root of an HTML document, encapsulating all other elements, including
and
, while excluding the DOCTYPE declaration. Although the
tag is implied if omitted, it is crucial to include it to clearly define the document's structure and language.
Additionally, the tag can include a lang attribute, such as
, which specifies the primary language of the document. This attribute uses a two- or three-letter ISO language code, and while the region is optional, it is advisable to include it since language usage can vary significantly across different regions. For example, you might use
lang="en-US"
for American English or lang="en-GB"
for British English, enhancing accessibility and search engine optimization.
The Head
Nestled between the opening and closing tags, the
element serves as one of the two primary children of an HTML document, the other being
. The
section, often referred to as the document metadata header, contains essential information about the site or application that is not directly displayed on the webpage.
Within the , you can include several key elements, such as:
- : Provides metadata, like character encoding and viewport settings. For example:
-
: Sets the title of the webpage, which appears in the browser tab:
Learning HTML : Links to external resources, such as stylesheets:
: Includes JavaScript files or scripts directly.
: Contains internal CSS styles.
: Specifies a base URL for relative URLs in the document.: Provides content for users who have disabled JavaScript.
Overall, the element is crucial for configuring the document's metadata and linking necessary resources, thereby enhancing the webpage's functionality and accessibility.
Character Encoding and Document Title
The declaration is essential for specifying character encoding in an HTML document, enabling the inclusion of a wide range of characters and symbols, including emojis (though it's generally advised to avoid using them). By setting the character encoding to UTF-8, you ensure that all text in the document, including content in
and
tags, inherits this encoding. This flexibility allows for the use of emojis in class names and selectors, but any use of such characters should be carefully considered to maintain usability and accessibility.
The
element, located within the , serves as metadata that defines the title of the HTML document, distinct from the content itself. The text placed between the opening and closing
tags is displayed in the browser tab, as well as in the history, search results, and social media previews, unless overridden by other tags. For example, a title like
will appear in the browser tab, helping users identify the page. This makes the
element a crucial aspect of web page navigation and user experience.
Viewport metadata
The viewport meta tag is a critical component for ensuring responsive web design, allowing content to adapt effectively to various screen sizes and enhancing overall user experience. The typical declaration looks like this:
name="viewport"
: This indicates that the meta tag provides information about the viewport, which is essentially the visible area of a webpage on different devices, including desktops, tablets, and mobile phones.content="width=device-width, initial-scale=1.0"
: This part contains key settings for the viewport:width=device-width
: This property sets the viewport's width to match the device's width, ensuring that the webpage uses the full width of the screen without unnecessary scaling.initial-scale=1.0
: This property defines the initial zoom level when the page loads, with a value of 1.0 indicating no zoom—meaning the content appears at its intended size.
By implementing the viewport meta tag, developers can create websites that are visually appealing and functional across a wide range of devices, making it an essential element for modern web development.
The Body
The tag is fundamental in defining the main content of an HTML document. It encompasses all visible elements that users interact with, such as headings, paragraphs, images, hyperlinks, tables, lists, and more.
It's important to note that an HTML document can only contain one element. Within this element, various HTML tags are utilized to organize and present the content effectively.
1. Headings:
to
2. Paragraph:
3. Links:
4. Lists:
Ordered List: