Why do we have a such difficult way to add a stylesheet to a page?
I mean javascript we add like
<script src="nope.js"></script>
and inline is
<script>
alert("I refuse.");
</script>
but styles is a story apart inline is
<style>
* {
color:white;
background:white;
}
</style>
and a file is
<link href="/themes/black-wide.css?r=2408" rel="stylesheet" type="text/css">
Why do we need to use link?
isn’t it more logical to use
<style src="style.css"></style>
instead of link?
Why is this like that?
EDIT
just to make it more clear.
WHY in do we need to use link instead of style to point to a css file.
When you think about it,
<link>is actually much more versatile than<style>would be. You have to remember this part of the spec was defined in the early days of the internet, before CSS was even in use much (if at all).I think the folks at the W3C, when they set this standard, intentionally left room for other uses of the
<link>tag besides stylesheets. Semantically,linkjust means some reference to an external resource. Those uses may not have ever arisen, but there is room for them here. Perhaps the better question is why don’t we use thelinktag to load scripts, as well.