html - Difference between SRC and HREF -
SRC
and HREF
attributes to include some external entities Used like an image, a css file, an HTML file, any other web page or javascript file.
Is there a clear discrimination between I give some examples below where these properties are: Note: @ John-Yin is more appropriate about changes in glasses. Yes there are differences between src and href and they can not be used alternately between referenced documents and external resources. For the elements to establish a relationship we use href for src . The Href (hypertext reference) attribute specifies the location of the Web resource, thus present element (anchor The browser understands that this resource is a stylesheet and the parsing of src (source) attribute only embeds the resource in the current document in place of the definition of the element, for example when the browser searches The page is loading and processing is paused until the browser fetches, compiles and executes the browser. This is similar to dumping the contents of the JS file inside the This is the reason that it is advisable to load all JavaScript files below ( Update : For more information about how this is implemented according to HTML5 specs, see @John-Yin. SRC
and HREF
? When or when should I use SRC
or HFF? I think they can not be used each other.
href = "cssfile.css" inside the link tag
. src = "myscript.js"
inside the script tag. src = "mypic.jpg"
inside an image tag. href = "http: /www.webpage.com" inside an anchor tag
in the case of a
) or current document ( If link
) and destination anchor or resource defined by this attribute When we write:
& lt; Link href = "style.css" rel = "stylesheet" />
processing page is not (prevented from rendering) The browser needs style rules to color and render the page). It is similar to dumping the contents of the CSS file inside the style
tag No
& Lt; Script src = "script.js" & gt; & Lt; / Script & gt;
script
tag, in a similar manner it is a case with the img
tag, it is an empty tag and content that it comes in. Should be defined by the src
attribute. Stops the browser until it loads until it brings the image and does not load. [This is the case with the iframe
] & lt; / body & gt;
tag)
Comments
Post a Comment