what's the difference between href and src? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

what's the difference between href and src?

I mean they say "href" is for external links, and src is for local stuff, but then we use "href" to link our CSS file which is already in our local disk🤔. Pls Explain 🙏

7th Jan 2021, 1:50 AM
Precious Nwaoha
Precious Nwaoha - avatar
2 Answers
+ 6
href: Is a reference to information for the current page ie css info for the page style or link to another page. Page Parsing is not stopped. src: Is a resource to be added/loaded to the page as in images or javascript. Page Parsing may stop depending on the coded attribute. That is why it's better to add script just before the ending body tag so that page rendering is not held up. Hence <src> adds some resources to the page and <href> is just for providing a link to a resource(without adding the resource itself to the page).
7th Jan 2021, 5:29 AM
Dalia Matus
Dalia Matus - avatar
+ 1
Dilia Matus Thanks I now understand it👍
7th Jan 2021, 10:25 AM
Precious Nwaoha
Precious Nwaoha - avatar