Bell R. HTML Essentials. A Beginners Guide To Web Development 2024bell R. HTML Essentials. A Beginners Guide To Web Development 2024
Bell R. HTML Essentials. A Beginners Guide To Web Development 2024bell R. HTML Essentials. A Beginners Guide To Web Development 2024
Introduction
Welcome to "HTML Essentials: A Beginner's Guide to Web
Development," a comprehensive journey into the world of
web development through the lens of HTML. This ebook is
crafted with the purpose of demystifying the foundational
language of the web for those who are taking their first
steps into web development. Our goal is to provide you with
a solid grounding in HTML, equipping you with the
knowledge and skills needed to begin creating your own
websites.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
<!DOCTYPE html> declares the document type and
version of HTML.
<html> is the root element that wraps the entire
document.
<head> contains meta-information about the
document, like its title and character set.
<title> sets the title of the web page, which appears in
the browser tab.
<body> encloses the content of the page, such as text,
images, and links.
Practical Exercise: Creating a Simple HTML Page
Content Structuring
Headings (h1 to h6) and Paragraphs (p)
<h2>Subsection Heading</h2>
<li>Item One</li>
<li>Item Two</li>
</ul>
<ol>
<li>First Item</li>
<li>Second Item</li>
</ol>
<dl>
<dt>Term One</dt>
<dd>Definition One</dd>
<dt>Term Two</dt>
<dd>Definition Two</dd>
</dl>
</div>
Creating Hyperlinks
Using the Anchor Tag (<a>)
You can use the anchor tag and IDs to create navigation
links that jump to specific sections within the same page. To
do this, assign an id attribute to the element you want to
link to, and then create a link with an href attribute that
references that ID.
...
Clicking on the link will take the user directly to the content
of Section 1.
<!DOCTYPE html>
<html>
<head>
<title>Navigation Example</title>
</head>
<body>
<header>
<nav>
</nav>
</header>
<div id="section1">
<h2>Section 1</h2>
</div>
<div id="section2">
<h2>Section 2</h2>
</div>
</body>
</html>
Embedding Images
Using the <img> Tag
<audio controls>
</audio>
<video controls>
</video>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>Image</h2>
<img src="example.jpg" alt="Example Image"
width="500">
<h2>Audio</h2>
<audio controls>
</audio>
<h2>Video</h2>
</video>
</body>
</html>
Creating Forms
Form Tag and Its Attributes (action, method)
</form>
Organizing Forms
Fieldsets and Legends for Grouping Form Elements
Example:
<fieldset>
<legend>Personal Information</legend>
<label for="name">Name:</label>
</fieldset>
Example:
<label for="username">Username:</label>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Contact Us</h1>
<fieldset>
<legend>Your Details</legend>
<label for="name">Name:</label>
<label for="email">Email:</label>
<label for="message">Message:</label>
</form>
</body>
</html>
Introduction to CSS
How CSS Enhances HTML
Inline CSS
style
Internal CSS
uses the
<style>
<head>
<style>
p { color: red; }
</style>
External CSS
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<ul class="styled-list">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</body>
</html>
body {
background-color: #f0f0f0;
h1 {
color: #333;
font-size: 24px;
p{
margin: 20px 0;
padding: 10px;
}
.styled-list li {
background-color: #e9e9e9;
margin: 5px;
padding: 5px;
HTML Validation
Tools for Validating HTML
While HTML and CSS are crucial for structuring and styling
your web pages, JavaScript (JS) adds interactivity and
dynamic content. Learning JavaScript allows you to: