Add a link to your website

Author: Roger Morrison
Date Of Creation: 19 September 2021
Update Date: 21 June 2024
Anonim
How to Create Web Pages Using HTML : How to Add a Link to a Web Page
Video: How to Create Web Pages Using HTML : How to Add a Link to a Web Page

Content

Links or hyperlinks, usually abbreviated as "links", are the backbone of the Internet and of websites in particular. Links allow users to click on a piece of text or an image, which will redirect them to another web page. This makes them an inseparable part of the internet. Creating a link as part of your website requires very little HTML code. Here we show you how.

To step

Method 1 of 2: A Simple Link

  1. Create the text or place the image you want to use as a link. Links are created with a few simple html tags when editing the code of your website. But first it is important to know what you want to put inside the tags. This can be text, an image, or another html element, but here we just use a line of text.
  2. Place two tags around the text. Hyperlinks are indicated with two simple tags, one to open the code and one to close it. Without attributes this is not really useful yet, but we are going to do something about it.
    • Your link might look like this: Click here to visit my new website.
  3. Add the "href" attribute to indicate where the link leads. The "href" attribute tells the browser where to direct the user when the link is clicked. This attribute is followed by an equal sign and then by the address in quotation marks after it.
    • The above example should now look like this: click here to visit my new website.
    • Note that if the destination of the link is another website, you must provide the full url (it usually starts with "http"). If only the name of the page is given, then it is assumed to be searched within the directory of the website.

Method 2 of 2: Adding Email and Anchors

  1. Create a link from an image. This is very easy to do by adding an image tag within the link tags. You will need the address of the location of the image (i.e. the location on your server or someone else's). Here is an example of what an image link might look like:
    • a href = "the_url_of_the_image.html"> img src = "image.webp" /> / a>
  2. Create an email link using the "mailto:protocol. To create a link to compose an email to a specific address, use "mailto:" and place it directly in front of the person's email address.
    • An e-mail link could look like this: click here to ask a question or make a comment.
  3. Create anchors within a larger web page for easy reference. If you are looking for a way to link to a specific part of a web page, use an anchor. Anchors are very useful for larger pages with a table of contents; each chapter or paragraph can be assigned an anchor linked to the table of contents. Anchors are created with the "name" attribute.
    • To create an anchor, insert the tag in the right place on the page, such as: Chapter 3 - Using Anchors in HTML
    • To link to the newly created anchor, use the # sign as follows: #Go to Chapter 3

Tips

  • You do not need any special software to build a website, and most computers have the correct software installed by default. An example is the Notepad / Notepad in Windows. Just enter the codes and save them as html. To be able to see what this looks like in practice, you do need a browser, which is often not necessary in more advanced programs. In addition, there are no options to check code for syntax and whether it complies with the standards.
  • Use CSS styles to change the color and other properties of links.

Necessities

  • A computer
  • An editor such as Notepad, or web design software