Difference between absolute and relative URL in HTML

Difference between absolute and relative URL in HTML

In this article, we will see what is Difference between absolute and relative URL in HTML.

Basically, There are two types of URLs:

1. Absolute URL

2. Relative URL

What is Absolute URL?

In Which the full directory path is included with a domain name or root folder name.

When the domain or root folder is different, this method is typically applied.

Example:

<img src="www.example.com/assets/logo.png" height="300" width="200"/>

What is a Relative URL?

In which only the file path is included without the domain name or root folder name.

utilized most often when the domain or root folder is the same.

<img src="assets/logo.png" height="300" width="200"/>

Subscribe to our Newsletter

Stay up to date! Get all the latest posts delivered straight to your inbox.

If You Appreciate What We Do Here On TutsCoder, You Should Consider:

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Leave a Comment