Home CS SEO HTML
Night More

Revise Now

Cambridge AS levels

Physics Chemistry Computer Science

Programming and coding

Learn HTML Learn SEO

More

What do you want
to do?

Contact us Donate Support More Services Send a tweet Social media




more topic chapters

HTML Links - href & target attributes

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

Run

The href is used to define the url

Let's take an image as an example

revise zone cover page

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

The Target attribute

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

Run

We will give some example

This is _blank

This is _self

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





Revisezone.com Copyright 2020 Developers & Coding section