Linking to a specific item on a page

by jcook on January 25, 2010

When you’ve been creating web pages as long as I have, it’s easy to start thinking you’re hot stuff. Then along comes some perfectly obvious little html shortcut that you’ve been overlooking for a decade. It tends to humble you pretty quickly!

And judging by the response at the DreamweaverClub.com forum, I wasn’t the only one surprised by this one. So I thought I’d share it with you.

As you know, when you link to a page using a normal link (such as <a href=”http://www.dwcourse.com”>DWcourse</a>) the link takes you to the top of the page. And, as many of you no-doubt also know, you can also insert an empty, non-link Anchor Tag (such as <a name=”item” id=”item”></a>) into your page and then link directly to the location of the Named Anchor within the page like this <a href=”http://www.dwcourse.com#item”>Link directly to item on DWcourse page</a>. To insert a named anchor in Dreamweaver select menu: Insert>Named Anchor.

Now here’s the obvious html fact that that I’d been overlooking. You don’t have to insert a named anchor into your page to link to a specific point within the page. You can link directly to any named object within your page. For instance, if you want to link to particular sub-sections of your page, each of which begins with an level 2 heading <h2> you can give each h2 a unique ID and link directly to it. In Dreamweaver you can assign an ID to an html object by selecting the object and typing the ID into the ID field in the Properties Inspector.

So, if your page looks like this:

<h1>Main Headline</h1>
<h2 id=”section1″>section 1 </h2>
content for section 1
<h2 id=”section2″>section 2 </h2>
content for section 2
<h2 id=”section3″>section 3 </h2>
content for section 3

You can link directly to section 2 from within the current page like this: <a href=”#section2″>Section 2</a> or from another website like this: <a href=”http://www.dwcourse.com#section2″>DWcourse Section 2</a>. No need to clutter up your code with an empty Named Anchor!

And, to point out the (now) obvious, the # (number sign) within a link refers to a named html object within the page, just as a # within a CSS selector refers to a named object.

{ 1 comment }

Adobe BrowserLab Dreamweaver Extension Upgraded

January 14, 2010

If you use the Dreamweaver Extension for BrowserLab (and I recommend it) you should update it.
Information and the download files are available at http://labs.adobe.com/downloads/browserlab.html
Note: Read the instructions carefully:

Installation requires installing two extensions.
If updating it is necessary to manually remove the old BrowserLab extensions.
If you’re installing for the first time, make sure to install the Extension [...]

Read the full article →

Stopping Untitled Documents Take 2

December 9, 2009

I feel a bit stupid. In my recent Stop “Untitled Document” in Dreamweaver post I reported what I thought was a very clever way to find pages titled “Untitled Document” using Dreamweaver’s search function. It turns out there’s a built-in function that will will do the job:

Select menu: Site>Reports…
In the reports dialog:

Leave Current Local Site selected [...]

Read the full article →

Stop “Untitled Document” in Dreamweaver

December 8, 2009

If you’re like most folks, you occasionally forget to re-title you pages in Dreamweaver and then look foolish when you end up with pages titled “Untitled Document” (see Google search for “Untitled Document”). I like to check all my page titles before uploading a site but it’s a pain to open every document and it [...]

Read the full article →

Dominate Dreamweaver Registration Open

September 14, 2009

Registration is open,  sign up now…
My online course Dominate Dreamweaver is now open for registration. The course consists of 12 weekly modules containing:

A digital text book broken into manageable weekly segments
“Over the shoulder” style videos illustrating the crucial tactics and concepts
Weekly “classroom” session webinars where I’ll go over each week’s material and answer any questions [...]

Read the full article →

Are You Ready to Dominate Dreamweaver?

September 8, 2009

Enrollment is now open. Sign up now…
On Sept 14th I opened registration on a full-fledged, interactive online Dreamweaver course. It will begin by building on the material I’ve already covered in Let’s Get Started with Dreamweaver and walk you step by step through the learning process until you’re able to create the visually stunning and [...]

Read the full article →

Dreamweaver Windows bug: Problems selecting local root folder

August 17, 2009

Important Update: I’ve recently seen a report that this bug can affect the selection of folders using the Find in menu of the Search and Replace dialog. Obviously searching and replacing in the wrong folder can have very dire consequences. So, if you choose to use the Find in Folder… option in Dreamweaver for Windows, [...]

Read the full article →
/* */