Introduction to HTML and Setup
This guide provides step-by-step instructions to set up and create your first HTML file. Follow these steps to get started with HTML:
1. Setup
Tools You’ll Need
Create a Project Folder
HTML_Project
.2. Create Your First HTML File
index.html
inside the HTML_Project
folder.Example: Basic Structure of index.html
My First HTML Page
Hello, World!
Welcome to learning HTML.
Explanation
: Defines the document type and version as HTML5.
: Root element of an HTML page.
: Contains meta-information about the HTML document.
: Sets the character encoding for the document.
: The title that appears on the browser tab.
: Contains the content of the HTML document.
: A heading tag, for the main heading.
: A paragraph tag, for general text.3. Open Your HTML File in a Browser
HTML_Project
folder.index.html
to open it in your default web browser.This completes the initial setup and introduction to HTML. You should see “Hello, World!” displayed in your browser. Save this file for future reference.
Basic HTML Structure
Basic HTML Page
Welcome to My Webpage
Home
This is the home section.
About
This is the about section.
Contact
This is the contact section.
Notes:
header
, nav
, main
, section
, and footer
elements for a basic layout.Unit 3: Working with Text in HTML
Step 1: Adding Headings
Working with Text
This is Heading 1
This is Heading 2
This is Heading 3
This is Heading 4
This is Heading 5
This is Heading 6
Step 2: Adding Paragraphs
Working with Text
This is a paragraph of text.
This is another paragraph of text.
Step 3: Text Formatting
Working with Text
This is bold text.
This is italic text.
This is underlined text.
Step 4: Lists
Working with Text
- First item
- Second item
- Third item
- First item
- Second item
- Third item
Step 5: Linking
Working with Text
Visit Example Website.
Step 6: Styling Text with Inline CSS
Working with Text
This is blue, large text.
Step 7: Emphasis and Strong Importance
Working with Text
This is emphasized text and this is strong text.
Step 8: Blockquote and Preformatted Text
Working with Text
This is a blockquote from another source.
This is preformatted text.
Line breaks and spaces will be preserved.
Use the snippets in your HTML files as needed to create and format text effectively.
Part 4: Links and Navigation
1. Links
Links and Navigation
Links and Navigation
Visit Example Website for more information.
Go to the Section 1 of this document.
Contact us at info@example.com.
Call us at +1 234 567 890.
Section 1: Introduction
This is the beginning of Section 1.
2. Navigation Bar
Navigation Bar
.navbar {
overflow: hidden;
background-color: #333;
}
.navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.navbar a:hover {
background-color: #ddd;
color: black;
}
Home
Welcome to our homepage.
Services
Here are the services we offer.
Contact
Get in touch with us.
3. Footer Links
Footer Links
.footer {
background-color: #333;
color: white;
text-align: center;
padding: 10px;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
}
.footer a {
color: white;
margin: 0 15px;
text-decoration: none;
}
.footer a:hover {
text-decoration: underline;
}
Main Content
This is the main content area of the page.
These codes implement links and navigation functionalities in HTML. Each snippet can be directly copied and used in web development projects to create links, navigation bars, and footers.
Adding Images and Media
1. Basic Image Addition
Adding Images and Media
2. Adding an Image with Specific Dimensions
Adding Images and Media
3. Using Images as Links
Adding Images and Media
4. Adding a Video
Adding Images and Media
<!-- Embedding a video using the
5. Embedding an Audio File
Adding Images and Media
<!-- Embedding an audio file using the
6. Embedding a YouTube Video
Adding Images and Media
Creating Lists and Tables in HTML
HTML Lists
Unordered List Example
Unordered List
- Item 1
- Item 2
- Item 3
Ordered List Example
Ordered List
- First item
- Second item
- Third item
Nested List Example
Nested List
- Item 1
- Subitem 1.1
- Subitem 1.2
- Item 2
HTML Tables
Basic Table Example
Basic Table
Header 1
Header 2
Row 1, Cell 1
Row 1, Cell 2
Row 2, Cell 1
Row 2, Cell 2
Table with Caption Example
Table with Caption
Monthly Sales
Month
Sales
January
$1000
February
$1200
Complex Table Example
Complex Table
Name
Contact Info
Email
Phone
John Doe
john.doe@example.com
123-456-7890
Jane Smith
jane.smith@example.com
098-765-4321
Conclusion
The above implementations demonstrate how to create various types of lists and tables in HTML. You can integrate these into your webpages as needed.
Forms and Input Elements
Example HTML Code
Contact Form
body {
font-family: Arial, sans-serif;
margin: 20px;
}
form {
max-width: 600px;
margin: 0 auto;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
}
.form-group input,
.form-group textarea,
.form-group select {
width: 100%;
padding: 10px;
box-sizing: border-box;
}
.form-group button {
padding: 10px 20px;
background-color: #007BFF;
color: white;
border: none;
cursor: pointer;
}
.form-group button:hover {
background-color: #0056b3;
}
Contact Us
Select Gender
Male
Female
Other
Explanation Comments
Contact Form
/* Basic styling for form */
Contact Us
Select Gender
Male
Female
Other
This HTML code can be directly applied to any web development project to implement forms and input elements.
Semantic HTML
Practical Implementation of Semantic HTML
Semantic HTML Example
My Website
Welcome to My Website
This is the home section where you can find a brief introduction.
About Us
Information about the website or the person who created it.
Our Services
Service 1
Description of the first service offered.
Service 2
Description of the second service offered.
Contact Us
Email: info@mywebsite.com
Phone: +1234567890
Additional Notes
header
, nav
, main
, section
, article
, address
, and footer
.styles.css
) and other assets are correctly linked.Introduction to CSS with HTML
Step 1: Basic HTML Structure
Introduction to CSS
Welcome to CSS with HTML
This is a simple paragraph to demonstrate CSS styling.
This paragraph will have a different style.
Step 2: Create styles.css
File
/* styles.css */
/* Universal Selector */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Body Styling */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
line-height: 1.6;
margin: 20px;
}
/* Header Styling */
header {
background: #35424a;
color: #ffffff;
padding: 10px 0;
text-align: center;
}
/* Paragraph Styling */
p {
margin: 10px 0;
}
/* Highlight Class */
.highlight {
color: #e8491d;
font-weight: bold;
}
/* Footer Styling */
footer {
background: #35424a;
color: #ffffff;
text-align: center;
padding: 10px 0;
margin-top: 20px;
}
Step 3: Apply the Implementation
To use this implementation, include the HTML structure in your HTML file (e.g., index.html
) and create a CSS file named styles.css
with the styles provided. Ensure both files are in the same directory or adjust the link path accordingly. This will apply basic CSS styling to the HTML content.
Feel free to add additional HTML elements or modify the CSS to further practice and expand upon this implementation.
My First Web Page
/* Add CSS directly within the HTML */
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 20px;
}
header, nav, section, footer {
margin-bottom: 20px;
}
header {
background: #f4f4f4;
padding: 10px;
}
nav ul {
list-style-type: none;
padding: 0;
}
nav ul li {
display: inline;
margin-right: 10px;
}
nav ul li a {
text-decoration: none;
color: #333;
}
footer {
text-align: center;
background: #f4f4f4;
padding: 10px;
}
Welcome to My Web Page
Home
This is the home section of the web page. Here, you can provide some introductory content about the website.
About
This section can contain some background information about yourself or the purpose of the webpage.
Contact
Ensure all files are saved with appropriate extensions and use a browser to view the HTML file.