Today marks the beginning of my journey into web development, and I started with the foundation: HTML (HyperText Markup Language). Here's a recap of what I learned today:
π§± HTML Structure and Elements
An HTML element is composed of:
- An opening tag
- Content
- A closing tag
Example:
<p>This is a paragraph.</p>
<h1>Main Heading</h1>
<h2>Subheading</h2>
<h3>Section Title</h3>
<h4>Sub-section</h4>
<h5>Minor Heading</h5>
<h6>Smallest Heading</h6>
βοΈ Formatting Text
I explored basic formatting tags:
-
<strong>
β bold and important text -
<i>
β italicized text -
<br>
β line break -
<mark>
β highlighted text -
<del>
β strikethrough (deleted) text
Example:
<p>This is <strong>bold</strong>, <i>italic</i>, and <mark>highlighted</mark> text.<br>
This word is <del>deleted</del>.</p>
π Hyperlinks and Attributes
The <a>
tag is used for hyperlinks. It includes attributes like:
-
href
β specifies the destination URL or file -
target
β specifies where the link opens
Target values:
-
_blank
β open in new tab -
_self
β open in same tab -
_parent
/_top
β used in framesets
Example:
<a href="https://example.com" target="_blank">Visit Example</a>
π File Paths
I learned the difference between absolute and relative file paths:
Absolute Path
Gives the full URL or location of a file:
<a href="https://example.com/images/photo.jpg">View Image</a>
Relative Path
Specifies a file's location relative to the current document:
<!-- Same directory -->
<img src="photo.jpg">
<!-- Subdirectory -->
<img src="images/photo.jpg">
<!-- Parent directory -->
<img src="../photo.jpg">
πΌοΈ Images in HTML
The <img>
tag embeds images and includes:
-
src
β path to the image -
alt
β alternative text (for accessibility and fallback) -
width
andheight
β controls image size (px or %)
Example:
<img src="cat.jpg" alt="Cute Cat" width="300" height="200">
Image as a Link
Wrap the image in an <a>
tag to make it clickable:
<a href="https://example.com">
<img src="logo.png" alt="Clickable Logo">
</a>
Top comments (0)