Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Using named anchors

From: Dreamweaver CS5 Essential Training

Video: Using named anchors

While linking to other pages is usually the norm, there are times when you need to link to places within the same page. Usability is an important consideration when designing Web sites. Although people will usually tolerate scrolling a little bit for your information, if they have to scroll a lot, you are usually going to end up with some unhappy visitors. Named Anchors allow us to link to places within the same page, allowing users to just jump further down the page, for example. Named Anchors are aptly named because instead of the normal href attribute the links used to resolve the new location, Named Anchors are merely A or anchor tags that have a name and an ID attribute.

Using named anchors

While linking to other pages is usually the norm, there are times when you need to link to places within the same page. Usability is an important consideration when designing Web sites. Although people will usually tolerate scrolling a little bit for your information, if they have to scroll a lot, you are usually going to end up with some unhappy visitors. Named Anchors allow us to link to places within the same page, allowing users to just jump further down the page, for example. Named Anchors are aptly named because instead of the normal href attribute the links used to resolve the new location, Named Anchors are merely A or anchor tags that have a name and an ID attribute.

Other links can reference this name to navigate to the location other than Named Anchor on the page. Since Named Anchors typically do not contain any text and since they have no href attribute, they are totally invisible to the user. They are normally only used as points for the user to navigate to. So here we have our frequently asked questions, or faq.htm file open. And if we scroll down a little bit, it becomes apparent why Named Anchors are going to be such a nice addition to this page.

So, we have Frequently Asked Questions for each of the tour packages. And we have about five or six questions for each tour package. So, by the time you get to the last tour, you have done a lot of scrolling down towards the bottom of the page. So we are going to try to make life a little bit easier by allowing people to jump a little bit further down. Now if you're paying attention to the page, you've also noticed that we already have links down here to allow a person to return to the top of the page. That is a really good point of usability. If you are going to allow somebody to jump further down the page to your content, you should also give them easy access back up to where they were before.

Just because they don't have to scroll down doesn't mean that they are going to want to scroll back up. Okay. So, creating Named Anchors and using them is pretty much a two-step process. The first step is to create the anchors themselves, and then the second step is then to then create a link to those anchors. So, that's what we are going to do first. We are going to go ahead and create the Named Anchors themselves. All right. So, I want to scroll towards the top of the page, but what I want to do is place my cursor right here in front of the large headline FAQ.

This is where I want people to be able to jump back to if they have been reading my Frequently Asked Questions. Why? Because just below this is the navigation to be able jump down the page. That way they can read a little bit, jump right back up to the navigation and jump back down again. So, it's kind of a nice little system, so inserting a Named Anchor on the page is really, really simple, and the easiest way to do that is through the Insert panel. So, if we look at the Insert panel and we find our common objects, you'll find this very, very nice little anchor symbol that is our Named Anchor.

And you just want to click on that to insert a Named Anchor on the page. Now when we name our anchors we have to use standard naming conventions, so don't use any spaces, try to avoid punctuation and that sort of thing. As a matter of fact, I try to keep them to one word. If I do have to use two words, I usually use CamelCase naming, but underscores are also okay. I am just going to name this one top, because that's exactly what this link is. It's the top link on the page. Keeping them short makes them easy to remember and a lot easier to link too as well.

I am going to go ahead and click OK and in comes my Named Anchor. Now Dreamweaver shows us something pretty curious on the page now. And if I deselect it, I can see it a little bit more clearly. I see a little shield with that anchor symbol on it. And if I hover over that, and click on it, I can see in the Properties Inspector that's my Named Anchor, and its name is top. I'm free to change that name anytime that I want. So once you place it on the page, if you've forgot to name it something, or if you have meant to change the name, you can simply click on that and change it. Now what is this? Well, that little yellow shield is something that we call invisible elements.

And they can actually cause your layout look like it's shifting around, because Dreamweaver has to make a little bit of space for them. The fact of the matter is though, no one will ever see them. You're only seeing them if you are in Dreamweaver because otherwise they are in the code, but they are invisible, so in Design view we wouldn't be seeing them. As a matter of fact, if I go to Split view, we can see right here is our new Named Anchor. a name="top" ID="top" and then the anchor tag closes out, so there is nothing inside of that, there's no text, and it just has a name and an ID.

Also, if you don't like these shields, if they kind of bug you and they get in your way, there is a couple of ways to get rid of them. Number one, you can go right up here to your Document toolbar, go to Visual Aids, and you can turn off Invisible Elements right there. So that's a nice little toggle. Also, if you go to Edit and choose Preferences, on the Mac you would go to Dreamweaver in Preferences, you'll also find an Invisible Elements category. Here you get to choose exactly which items show up as an invisible element. So, if you didn't want Name Anchors to show up at all, but you still wanted some of your other invisible elements to show up, you could simply deselect the check box here.

I am going to hit Cancel because I don't want to make any changes. I kind of like having them out there. And as you are going to see in just a moment, they sort of extend our functionality a bit. Okay. So, we have a little bit of work to do now. What we are going to need to do now is place Named Anchors at the top of each of those individual sections. So, I am going to place my cursor right in front of Backpack Cal, insert another Named Anchor, and I am going to name this one backpack. Again, we're just going to try to keep them short and just try to keep them single names. If I scroll down, I can see that the next section is California Calm.

Now this time I am actually going to place my cursor on the line just above the headline California Calm. Later on we would begin to test them, and I'll talk about why I'm placing the Named Anchor here. I am going to add another Named Anchor on the Page, and this one is going to be calm. Now just keep scrolling down. Place another anchor on the page here. This anchor is going to be hotsprings. I am going to keep scrolling down. Above Cycle California, I am going to place the anchor cycle, so you can see you can pretty much get into a rhythm with this.

From Desert to Sea, I am going to insert another Named Anchor. I am going to call this one desert. Now once again, it looks like everything is shifting down. Don't panic. That's not a big deal. The Named Anchor just needs a little bit of room visually, but since that's an invisible element, when you preview that in your browser you won't see it. So there we've just created the Named Anchor kids. We will follow that up with nature in the next section, snowboard just underneath that. And then, finally, for Taste of California we'll just do taste.

So, it's pretty easy to put in your Named Anchors. It's a very fast process, but one of the things you want to do is make sure that you have a naming convention already set up and that you are aware of what that naming convention is. It's just going to make creating the links themselves a little bit easier. Okay. So now that we've done that, we need to go ahead and create our links. So, if I scroll back up, I can see that we have this navigation section up here Backpack Cal, California Calm, so the users would click on that to jump down to the actual link themselves. Well, there are a couple different ways to create these links, and they are very easy to do.

I am going to go ahead and highlight the text Backpack Cal and using the Point to File icon down here in the Properties Inspector, I can literally just point right there to the invisible element. As soon as I let go, notice that it resolves it as #backpack. So, that's one of the reasons to keep the invisible elements on the page. We can use the Point to File icon to quickly point to those. Now notice also how this link was resolved. This is really important. Do you notice the # symbol in front of the word backpack? Well, pound identifies that as an ID.

So, to link to any Named Anchor on the page, all you have to do is pass its ID as the href of the link, and it'll jump right to that specific point. Now we can certainly use the Point to File icon again. I can highlight California Calm, for example, use the Point to File icon and if it's off the page, just place your Point to File icon towards the bottom of page. It'll scroll automatically. If for whatever reason that doesn't happen, you can just place it right over the scroll bars at the bottom and then scroll that way too. Then you can point to the invisible element that the represents the link that you want and let go, and it resolves.

Honestly though, if you can remember what you've name them and it makes sense to you, typing them in yourself is the fastest way to do this. So notice I can just highlight Hotsprings right here, type in #hotsprings. You have to remember the pound symbol, and that link resolves. I am going to do the same thing all the way down. I am going to do #cycle, #desert, #kids. Also notice there is no space here, #nature, #snowboard and finally, #taste.

So yes the Point to File icon would have been fast, but I don't think it would have been that fast. Now we're not quite done. We have a one more thing to do before we can test our page. I know we have been working for a while, but let's go and take care of this really fast. We notice that we have some links down that say return to top. I am going to go all the way down to the very bottom of the page, so I can find the very bottom one of those and highlighting that link tag, I am going to type #top. Now after you've already resolved one of these links once, remember you don't have to do it again.

You can simply click in the next one, grab that pulldown menu and find #top. So after that, you don't have to keep typing them in or using the Point to File icon. You can simply click inside the link, grab the pulldown menu for the link itself and find the Named Anchor that you are going towards. That is really quick, really easy. You just want to make sure you are going to do that for every single one of those guys. And if you are more comfortable typing that in, there is nothing wrong with that either.

Okay. So, that should do it for us. I am going to go ahead and Save this file, and now I want to preview this in my browser so that I can test their functionality. So here I am previewing this in the Firefox and if I click on Taste of California, notice that it takes me all the way down to the bottom of the page. Clicking on the return to top brings me right back up to my Navigation. So, I can simply go anywhere that I want and click back and forth, simply by using the links that we've created. Now I want to point something out to you. Do notice how, instead of coming right up to the headline, we are actually landing just a little bit above it? That's because that's where we placed the Named Anchor.

The page is going to navigate exactly to that Named Anchor. So, if we were to place our Named Anchor in front of the K here, it would look like that. Now, there is nothing wrong with that. But think about usability. If you were to jump here, the first thing you would do is scroll up a little bit to make sure you hadn't missed anything. So by going ahead and placing that in there automatically, it sort of tells people, yes you are in the right place. So, I always put my Named Anchors just a little bit above where I want to link on the page. Now obviously, not every page you are working with is going to need Named Anchors.

However, when your data does require a lot of scrolling, or if you want to give people quick access to a specific location, Named Anchors allow you to add a lot of functionality to your page. In our next movie, we are going to take Named Anchors one step further by linking to a Named Anchor on an external page.

Show transcript

This video is part of

Image for Dreamweaver CS5 Essential Training
Dreamweaver CS5 Essential Training

135 video lessons · 89130 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 2m 57s
    1. Welcome
      1m 8s
    2. Using the exercise files
      1m 49s
  2. 7m 50s
    1. What is Dreamweaver?
      3m 16s
    2. Learning web design
      2m 22s
    3. Current web standards
      2m 12s
  3. 43m 9s
    1. The Welcome screen
      4m 5s
    2. Windows and Mac interface differences
      2m 23s
    3. The Application toolbar
      4m 7s
    4. The Document toolbar
      4m 40s
    5. Arranging panels
      8m 19s
    6. Managing workspaces
      7m 32s
    7. The Properties Inspector
      5m 54s
    8. The Insert panel
      6m 9s
  4. 25m 45s
    1. Basic site structure
      3m 11s
    2. File naming conventions
      1m 49s
    3. Defining a new site
      4m 35s
    4. Managing sites
      4m 51s
    5. Managing files and folders
      6m 36s
    6. Working with browsers
      4m 43s
  5. 27m 21s
    1. Creating new documents
      5m 16s
    2. New document preferences
      3m 6s
    3. Setting accessibility preferences
      4m 56s
    4. Working with starter pages
      3m 46s
    5. Managing starter pages
      10m 17s
  6. 30m 2s
    1. Basic tag structure
      2m 15s
    2. Adding structure to text
      8m 20s
    3. Creating lists
      9m 59s
    4. Getting text into Dreamweaver
      5m 59s
    5. Importing Word documents
      3m 29s
  7. 1h 17m
    1. Understanding style sheets
      2m 16s
    2. The anatomy of a CSS rule
      1m 48s
    3. Setting CSS preferences
      6m 36s
    4. The CSS Styles panel
      10m 2s
    5. Controlling CSS through the Properties Inspector
      5m 14s
    6. Using the Code Navigator
      7m 21s
    7. Using CSS Enable
      6m 45s
    8. Understanding element selectors
      8m 11s
    9. Understanding class selectors
      8m 49s
    10. Understanding ID selectors
      5m 59s
    11. Understanding descendant selectors
      6m 51s
    12. Attaching external style sheets
      7m 44s
  8. 1h 47m
    1. Working with units of measurement
      7m 11s
    2. Declaring font families
      9m 39s
    3. Controlling font sizing
      9m 9s
    4. Controlling weight and style
      8m 0s
    5. Controlling line height
      8m 29s
    6. Controlling vertical spacing with margins
      12m 3s
    7. Controlling spacing with padding
      5m 39s
    8. Aligning text
      8m 26s
    9. Transforming text
      5m 36s
    10. Writing global styles
      15m 42s
    11. Writing targeted styles
      17m 37s
  9. 1h 32m
    1. Understanding image types
      5m 3s
    2. Managing assets in Dreamweaver
      12m 51s
    3. Setting image accessibility preferences
      4m 20s
    4. Setting external image editing preferences
      3m 52s
    5. Placing images on the page
      7m 37s
    6. Photoshop integration
      5m 54s
    7. Modifying Smart Objects
      5m 51s
    8. Alternate Photoshop workflows
      8m 8s
    9. Modifying image properties
      11m 14s
    10. Styling images with CSS
      7m 11s
    11. Using background graphics
      9m 3s
    12. Positioning background graphics
      11m 6s
  10. 55m 16s
    1. Link basics
      3m 37s
    2. Setting site linking preferences
      2m 14s
    3. Creating links in Dreamweaver
      11m 1s
    4. Absolute links
      5m 8s
    5. Using named anchors
      11m 19s
    6. Linking to named anchors in external files
      2m 44s
    7. Creating an email link
      5m 24s
    8. Creating CSS-based rollovers
      13m 49s
  11. 1h 34m
    1. CSS structuring basics
      2m 56s
    2. The Box Model
      13m 21s
    3. Understanding floats
      6m 53s
    4. Clearing and containing floats
      8m 56s
    5. Using relative positioning
      4m 8s
    6. Using absolute positioning
      7m 18s
    7. Creating structure with div tags
      12m 7s
    8. Styling basic structure
      10m 34s
    9. Creating a two-column layout
      10m 37s
    10. Using Live View and CSS Inspect
      7m 51s
    11. Using Browser Lab
      9m 39s
  12. 56m 22s
    1. Reviewing table structure
      7m 41s
    2. Importing tabular data
      5m 13s
    3. Creating accessible tables
      9m 56s
    4. Using thead and tbody tags
      4m 0s
    5. Basic table styling
      8m 45s
    6. Styling table headers
      7m 52s
    7. Styling column groups
      4m 22s
    8. Creating custom table borders
      5m 1s
    9. Styling table captions
      3m 32s
  13. 1h 43m
    1. How forms work
      3m 0s
    2. Reviewing form design
      3m 2s
    3. Creating accessible forms
      7m 33s
    4. Setting form properties
      4m 6s
    5. The fieldset and legend tags
      4m 32s
    6. Inserting text fields
      5m 58s
    7. Inserting list menu items
      5m 26s
    8. Inserting checkboxes
      7m 50s
    9. Inserting radio button groups
      6m 22s
    10. Inserting text areas
      4m 12s
    11. Inserting submit buttons
      3m 37s
    12. Basic form styling
      12m 0s
    13. Form element styling
      8m 52s
    14. Styling form layout
      11m 49s
    15. Adding form interactivity
      2m 47s
    16. Using Spry validation widgets
      12m 49s
  14. 1h 23m
    1. Planning for templates
      10m 51s
    2. Creating a new template
      10m 37s
    3. Using editable attributes
      13m 43s
    4. Creating optional regions
      6m 23s
    5. Creating new pages from a template
      9m 17s
    6. Applying templates to existing pages
      6m 9s
    7. Working with nested templates
      7m 56s
    8. Working with repeating regions
      12m 58s
    9. Modifying templates
      5m 41s
  15. 40m 14s
    1. Behaviors overview
      3m 47s
    2. Hiding and showing elements
      9m 18s
    3. Spry overview
      4m 4s
    4. Using Spry widgets
      11m 36s
    5. Adding Spry effects
      3m 6s
    6. Using the Widget Browser
      8m 23s
  16. 28m 18s
    1. Inserting Flash files
      5m 4s
    2. Setting properties for Flash
      6m 27s
    3. Dreamweaver and Flash integration
      6m 6s
    4. Encoding Flash video
      6m 10s
    5. Adding Flash video
      4m 31s
  17. 45m 28s
    1. Running site-wide reports
      6m 33s
    2. Checking for broken links
      5m 41s
    3. Checking for browser compatibility
      8m 3s
    4. Adding remote servers
      8m 0s
    5. Uploading files
      7m 20s
    6. Managing remote sites
      9m 51s
  18. 34s
    1. Goodbye
      34s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Dreamweaver CS5 Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.