what does link href="#" do?


ANSWERS:


Probably some stylesheet that is to be loaded later on.


This does actually absolutely nothing except staying on the same page.

This comes from the Anchors that allow to jump on a part of a page (More specifically, on an id).

This is usually written to say that some link should be introduced here, because of its no-effectness. When you're coding a website, it's often useful to show links, even if the page the link refers to isn't yet existing. This is very often meant to be a temporary solution.

As specified in Ryan's and Tom's answers, it could also be to be used to load dynamically the CSS files.


Without a base element, it does not do anything, except consume the browser’s resources a little. By URL specifications, as a URL is a reference to the start of the document at the current base URL. Since the tag would have to be in an HTML document, it would fail (either because the document is served with an HTML media type or after the browser has in vain tried to parse HTML with a CSS parser).

If you use a base tag that sets the base URL to one that refers to a CSS document, it would technically work, e.g.

<!doctype html>
<title>Demo</title>
<base href="">
<link href="" id="colour-scheme" rel="stylesheet">
<h1>Hello world</h1>

This would be rather abnormal, really, and it would effectively prevent you from using relative URLs otherwise in the document. So this is just a theoretical possibility, rather than what’s really going on.

Probably href="" is just a placeholder here, to be overwritten by JavaScript code, or something. It’s bad coding style for several reasons. It would be better to omit the href attribute (even though this is technically invalid in HTML5) and have one inserted dynamically.


<link href="" id="colour-scheme" rel="stylesheet">

href : This is to specify the location of the CSS file you want to import in your web page

when using href="" it won't import any CSS file.


Using a hash () as the reference is often done by developers yet to include the actual reference when it's not known, however if this is on a live website it may be that JavaScript is being used to load a stylesheet based on the users colour-scheme choice. Before they've made that choice no colour scheme is required so no reference is given, hence the .


Using a in a link tag is commonly used to allow you to use javascript with later on if the URL is unknown or doesn't need to be set by default.

Example:

HTML

<link href="" id="colour-scheme" rel="stylesheet">

JS

document.getElementById("colour-scheme").href=""; 

This allows you to set the URL of the stylesheet in JS rather than statically set the location.


My Guess, as per the html link tags its mainly used to link the external files like

href=""

Since you are using href="" it would not do anything / serve any purpose.


Generally we use to call our css file for example below. Suppose I have a html file and I want to call my external css file, at that time I need to use . For more information please check this link


href = uri

This attribute specifies the location of a Web resource, thus defining a link between the current element (the source anchor) and the destination anchor defined by this attribute.



 MORE:


 ? what does link href="#" do?
 ? what does link href="#" do?
 ? Is an anchor tag without the href attribute safe?
 ? a href link for entire div in HTML/CSS
 ? CSS attribute selector does not work a href
 ? What does "href" stand for?
 ? Convert blob URL to normal URL
 ? Why use javascript:void(0) instead of # in href?
 ? Why use javascript:void(0) instead of # in href?
 ? Why use javascript:void(0) instead of # in href?