DEV Community

Charity Parks
Charity Parks

Posted on

 

HTML Linking to other sites vs. linking to other pages on the same site

Sometimes when writing HTML to format your website you will come across the need to create a link to an outside website. Other times you will want to create a links to other pages on your website.

Lets say you want to create a list of links to an outside website (URL). You will be using the <a> element plus the 'href' attribute. We will insert the URL's/websites into this code like so:

<p>My Top Stores:
<ul>
<li><a href="http://www.kohls.com">Kohl's</a></li>
<li><a href="http://steinmart.com">Steinmart</a></li>
<li><a href="http://bestbuy.com">Best Buy</a></li>
</ul>
</p>

The result...

My Top Stores:

Now when linking to other pages within the same website it is written like this:

<p>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about-me.html">About Me</a></li>
<li><a href="my-stores.html">My Stores</a></li>
<li><a href="contact-me.html">Contact Me</a></li>
</ul>
</p>

The result...

Top comments (0)

DEV The only reason people scroll to the bottom... 
is because they want to read more.

Sign up for an account to bookmark, comment, and react to articles that interest you.