Twitter | Search | |
Sung M. Kim Jul 16
I haven't a clue why I can't write CSS link tag from memory. <link rel="stylesheet" type="text/css" href="theme.css"> Always mix "href" with "src"... 🤔 The question is what's the difference between "src" and "href"? Why does "img" use "src" while "a/link" use href? etc
Reply Retweet Like
V Jul 16
Replying to @dance2die
One is a link (pointing to a resource), one is a requesting a source. <a href="https://image.jpg"><img src="https://image.jpg" /></a> will embed (request src) & link to it. They are different things. CSS is a src request. I am doing both here:
Reply Retweet Like
Sung M. Kim Jul 16
Replying to @vuildco
'CSS is a src request'. Why would "link" use "href" instead of "src"? "script" requires a script "src" (download/parse/run) as "link" requires a css "src" (download/parse/apply), as well.
Reply Retweet Like
V
Good point. I think it *should* be src. If you saw how we got here, you'd be surprised anything works or makes sense. You could possibly try the creator of CSS or (JS creator) because he knows everything tech, but should grab first. 😉
Reply Retweet Like More
Sung M. Kim Jul 16
Replying to @vuildco @wiumlie and 2 others
I hope this was just how it works due to some "history". That way I can simply just "memorize" them 😉 (but my 🧠 won't let me unless I understand the "why" behind in)
Reply Retweet Like
V Jul 16
Replying to @dance2die
All <link in the header uses a href so I'd say that is the default. Maybe it was "we link to this resource & apply" rather than "we embed this resource". I'm guessing.
Reply Retweet Like
Håkon Wium Lie Jul 17
CSS uses <link href...> because the HTML2 specification said so. I also find myself typing src. We could have saved one byte there!
Reply Retweet Like
Sung M. Kim Jul 17
Replying to @wiumlie @vuildco and 2 others
Thank you, Håkon for sharing interesting history and the story. 🙏 So they are inconsistent cuz the spec said so 🙂
Reply Retweet Like