---
title: "URL, SRC and HREF attributes in HTML"  
description: "URL, SRC and HREF attributes in HTML"  
author: "Anonymous User"  
published: 2021-07-20  
updated: 2021-07-20  
canonical: https://www.mindstick.com/forum/156539/url-src-and-href-attributes-in-html  
category: "html"  
tags: ["html", "html5"]  
reading_time: 2 minutes  

---

# URL, SRC and HREF attributes in HTML

What is the [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between [URL](https://www.mindstick.com/forum/436/url-redirection), SRC and HREF [attribute](https://www.mindstick.com/blog/221/attributes-reflection) in [HTML](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript)?

## Replies

### Reply by Anonymous User

Yes. There is a difference between src and href and they cannot be used interchangeably. We use src for replaced elements while href to establish relationship between referenced document and external resource.

The href (hypertext reference) attribute specifies the location of a web resource and thus a link or relationship between the current element (in the case of anchors) or the current document (in the case of links) and the destination anchor or resource defined by this attribute. defines.

When we write:

```
<link href='style.css' rel='stylesheet' />
```

The browser understands that this resource is a stylesheet and that the processing of the page has not stopped parsing (rendering may be stopped because the browser needs style rules to paint and render the page). This is not the same as dumping the content of a CSS file inside a style tag. (It is therefore advisable to use links instead of @import to attach stylesheets to your HTML document.)

The src(source) attribute embeds the file into the contemporary webpage.

For example : when the browser finds

```
<script src='script.js'></script>
```

So, when the web page gets the src attribute it gets some additional documents from some other source in the server. It blocks the loading and processing of a contemporary webpage until it has loaded or fetched the entire file and is compiled or executed in the current document. JS files inside script tags serve to dump content into websites. The image tag is also the same, it is an empty tag and the content, which should come inside it, is defined by the src attribute. Therefore, the browser blocks the loading of the document or webpage until the image is completely rendered.

This is the reason why it is advisable to load all JavaScript files at the bottom (after the </body> tag)


---

Original Source: https://www.mindstick.com/forum/156539/url-src-and-href-attributes-in-html

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
