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...

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay