MaraGuide
  • Avatar Database
  • Anagram Sam Solver
  • Pet Valuation Tool
  • Battle Guide
  • Crossword Solver
  • Profile Completion
  • Guides
    • Boutique Tracker
    • Missions
    • Mystery Item
    • Microwave Recipes
    • Drew Transformations
    • Glowing Eggs
    • Sultan Tax
  • Mara Flash Games
  • Image Tools
    • Spotify Signature
    • Visitor Counters
    • Profile Status Bar
    • Goal Bar
  • MaraHTML
    • HTML Intro
    • Working With Images
    • Working With Text
    • Adding Links
    • Creating Tables
    • Miscellaneous
    • CSS Intro
    • Styling Boxes
    • Working With Colours
    • Styling Images
    • Styling Tables
    • Styling Text
    • Pseudo Classes
  • Mara:Force Backup
  • Enter MaraGuide


Ads added by hosting provider.
  • Home
  • Avatars
  • Tools
  • Spotify Signature

MaraHTML

Coding resources, tutorials and more.

HTML Links



Share this page:

Links are created with the <a> element which has an attribute called href. The value of this attribute is the url of the page you're linking to. Users can click on anything (be it text or an image), between the opening <a> and closing </a> tags.

If you want to style links based on if they've been visited, or are active, please see the pseudo class tutorial. (You need to know CSS for this first).


Linking to other sites


<a href="http://www.marapets.com/">Marapets</a>

Marapets


Linking to other pages on the same site


Note, this doesn't work on marasites, it's only for if you have your own site.

When linking to pages within the same site, you don't need to specify the domain name in the URL. You can use a shorthand known as a relative URL. If the page of the site is in the same folder, the relative URL is simply the file name. If it's in a different folder you have to include the file path.

<a href="htmlintro.html">HTML Intro</a>

HTML Intro


Linking to a specific part of a page


Note: Previously this was done with using the name attribute, with the <a> element, this is not supported by HTML5.

Before you do this you need to use the id attribute on the element you want to the link to go to.

<a href="#1">Link 1</a>
<a href="#2">Link 2</a>
Link 1 Link 2

You can also link to a specific part of a different page, provided it has an id attribute.

<a href='htmltext.html#lists'>Lists</a>
Lists

Opening links in a new tab/window


To do this you use the target attribute, and assign it the value of '_blank'.

<a href='http://www.marapets.com/' target='_blank'>
<img scr='http://images.marapets.com/layout/logo_final.png'>
</a>

Ads added by hosting provider.

MaraGlobe | Rules | Crafted with by Civ
MaraGuide ©