[HTML / CSS] <link href> and <script src>

By | December 16, 2016

I want to study nvd3.js to visualize the data. So I try to follow the tutorial one by one, and it starts to clog from the first line of html. Previously, if you saw the <link> tag <script> tag in the tutorial, you started copy and paste without any understanding. So, even though it’s the code that I’ve come across so often, I do not know if I think about what kind of code it plays. If you think about it, you can quickly get a real implementation, but at the end I thought I would not have anything left to do.

I try to pick up the most basic ones one by one.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.2/nv.d3.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.2/nv.d3.min.js"></script>

Href is the location of the file to link to via <a href>.
<Link> Definition

The <link> tag defines a link between a document and an external resource.
The description of link tag defined at http://www.w3schools.com/ is as above. Defines the connection between the external resource and the current document.

In other words, in the example above, you should link the current html with the external nv.d3.css. It means that the style defined in nv.d3.css will also be used in the current html.
<Link ref> Properties
The possible values ​​for <link rel> are as follows.
Alternate, archives, author, bookmark, external, first, help, icon, last, license, next, nofollow, noreferer, pingback, prefetch, prev, search, sidebar, stylesheet, tag, up

There are too many stylesheets, but let’s move on to the idea that stylesheets are used to separate style information from external .css files.
If so, what is the next line <script src>? I used to use javascript, but does the script just mean javascript?

The <script> tag is used to define a client-side script (JavaScript).
The definition of <script> tag is the code to operate the client-side script. You can use <script> only by default, or explicitly define javascript like <script type = “text / javascript”>.

If so, I was wondering if there are any other scripts that could be included in the script’s type attribute.

  • Text / javascript (this is default)
  • Text / ECMAScript
  • Application / ECMAScript
  • Application / javascript

Four of these are used as examples, and JavaScript and ecmascript appear to be mainly used. Note that if you do not use the “type” attribute, type = “text / javascript” will be used by default.

I’m curious about ecmascript, but I think it’s out of context, so I will try to find out later.

ECMA Script

<Script type = “text / javascript” src = “https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.8.2/nv.d3.min.js”>

In summary, if you sum up the above script, it means that you will execute the file of javascript type connected to src.

The link tag mentioned earlier is only a link to the .css file, and the script tag is the code that immediately executes the linked .js file.

(In fact, css is an acronym for Cascading Style Sheets.

4 thoughts on “[HTML / CSS] <link href> and <script src>

  1. Ventura IT

    Good post and straight to the point. I don t know if this is really the best place to ask but do you people have any thoughts on where to get some professional writers? Thank you =B


Leave a Reply

Your email address will not be published. Required fields are marked *