📘 Decent HTML Notes

Learn HTML step by step with simple examples



Lecture 4 :File path , DIV, class and ID

1. File Path in HTML

File paths tell the browser where to find files such as images, CSS, or JavaScript. You can use relative or absolute paths.

Example: Relative Path

<img src="images/photo.jpg" alt="My Photo">
    

Output (if image exists in images folder):

Example: Absolute Path

<img src="https://via.placeholder.com/150" alt="Online Image">
    

Output:(This is path of that photo from browser)

file-path image

2. DIV + Class + ID

The <div> tag is used as a container for grouping content. id gives a unique identifier to an element. class groups multiple elements under the same name.

Example: Using div

<div>
  <h2>This is inside a div</h2>
  <p>Paragraph inside div.</p>
</div>
    

Output:

This is inside a div

Paragraph inside div.

Example: Using id

<div id="header">
  <h1>Website Header</h1>
</div>
    

Output:

Example: Using class

<div class="note">This is note 1</div>
<div class="note">This is note 2</div>
    

Output:

This is note 1
This is note 2