We have discussed what links do
Links follow the HTTP protocol and directs the user to a desired location when clicked
Most html elements could be links - such as image a text or even a block. Most websites such as W3schools and codeacademy states that this is not possible, however it works fine
Here is an example of a link
RunThe href is used to define the url
Let's take an image as an example
Links are a powerful tool in webpage and it is used to create navigation links and even awesome cool buttons. However, this requires CSS to style links to create cool buttons
The < is by default a inline element. So it has no particular dimension or size. For it to have a shape we need to define it as a block which we will see later
Links have another attribute called the target attribute which defines how the file should be loaded. There are 5 methods of loading the file
target="_self" - this opens the document on the same tab. This is default
target="_blank" - this opens the document on a new tab.
target="_parent" - this opens the document on a parent tab. Just just above the iframe level.This is a bit difficult to understand but we will talk about it in the iframes chapter
target="_top" - this opens the document on a highest level tab. We will discuss it later
target="blank" - similar to _blank however it only opens a single blank and re uses it many times
RunWe will give some example
This is blank. Try clicking it many times to see the difference
There is also a 6th method which include iframes but we will discuss it later to avoid confusions