Home arrow HTML arrow Page 3 - HTML: Working with Special Characters
HTML

HTML: Working with Special Characters


In the last article we discussed formatting, colors, and working with backgrounds. In this episode, we'll learn how to work with links and special characters, called Entities, in HTML.

Author Info:
By: James Payne
Rating: 4 stars4 stars4 stars4 stars4 stars / 2
February 13, 2008
TABLE OF CONTENTS:
  1. · HTML: Working with Special Characters
  2. · Linking to Someone Else’s Website
  3. · Opening a Link In a New Window
  4. · How to Create a Mailto Link
  5. · Special Characters/Entities in HTML

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
HTML: Working with Special Characters - Opening a Link In a New Window
(Page 3 of 5 )

So far the links we have created have loaded in the same browser window. This is okay if we are linking to pages within our own site. But what about when we link to someone else’s site? Or what if we just want to display a page with a small bit of information? Loading the page in a new window allows the user to view whatever page they want, without leaving our site.

To create a link that will open in a new window, we use the following code:


<html>

<body>


<a href="somepage.htm" target="_blank">New Window</a>


<p>

Setting the target to _blank forces the page to open in a new window.</p>


</body>

</html>

The above code displays the text New Window and stores the link to somepage.htm. When the user clicks the link, it will open a new browser (this occurs because we set the target as _blank), which displays the samepage.htm.

Link to a Target on the Same Page

If you are creating a page with an index on it or a page with a bunch of sections, you can use an anchor to link to specific sections of that page.


<html>

<body>


<p>

<a href="#Apples">Apples</a>

</p>


<p>

<a href="#Bananas">Bananas</a>

</p>


<h2>Section 1</h2>

<p>blah blah blah</p>


<h2>Section 2</h2>

<p>blah blah blah</p>


<h2>Section 3</h2>

<p>blah blah blah</p>


<h2><a name="Apples">How to Eat Apples</a></h2>

<p>blah blah blah</p>


<h2><a name="Bananas">How to Eat Bananas</a></h2>

<p>blah blah blah</p>


<h2>Section 6</h2>

<p>blah blah blah</p>


<h2>Section 7</h2>

<p>blah blah blah</p>


<h2>Section 8</h2>

<p>blah blah blah</p>


</body>

</html>

The above code creates two anchor tags (<a href="#Apples"> and <a href="#Bananas">) with name attributes (><a name="Apples"> and ><a name="Bananas">). When the user clicks either the word Apple or Banana, they are transported to the section How to Eat Apples or How to Eat Bananas respectively.


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials