New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

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

Using named anchors

From: Dreamweaver CS6 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 websites. Although, people will generally tolerate scrolling okay if you can give them away to skip the scrolling and jump right to the information that they're looking for, they're going to be much happier users of your site. Well, that's where named anchors come in. Well, named anchors are aptly named, because instead of the way that the HREF attribute is normally resolved, links to named anchors reference instead an ID value allowing you to link to any element on the page that has a specific 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 websites. Although, people will generally tolerate scrolling okay if you can give them away to skip the scrolling and jump right to the information that they're looking for, they're going to be much happier users of your site. Well, that's where named anchors come in. Well, named anchors are aptly named, because instead of the way that the HREF attribute is normally resolved, links to named anchors reference instead an ID value allowing you to link to any element on the page that has a specific ID attribute.

Let's see how we can use that to enhance our navigation on the Frequently Asked Questions page, just to kind of show you give me an idea of what we were talking about here. I'm going to and preview this page in a browser. Well, you can see that we have a lot of questions here and it takes a little bit of time to scroll down through it. Now this page honestly is not that long; I've seen pages a lot longer than this, but the fact of the matter is if I could help somebody out and all they were interested in for example what say Financial Aid allowing them to jump to this section is actually quite helpful.

So that's what we're going to be doing here. I'm going to go ahead and close my browser, go back into Dreamweaver, and anytime that you're going to be using named anchors on the page there's actually kind of a two-step process. The first part of it is to make sure that you have the IDs assigned to the elements that you're going to jump to. So that's what we're going to do first off. So I'm just going to go ahead and click inside this headline for Common Questions and right there on the Properties Inspector we can go ahead and assign IDs. So this is very quick and very easy. I'm going to go ahead and assign this in ID of the top. Another thing that usability is if you're going to give people the ability to jump down to the bottom of the page, you really ought to give them the ability to jump back up as well so they don't have to scroll back.

Now I'm going to continue scroll down through the page and I can see that I have sections for Housing, Portfolio Review, Financial Aid, and Programs. So I'm going to click inside Housing and I'm going to give it an ID of, you guessed it, housing. Now it's a good idea to keep these IDs as short as you can, makes it easier for you to remember and resolve them. You also don't want to use any special characters or any spaces in IDs. IDs need to be one single word. For Portfolio I'm just going to do Portfolio and for Financial Aid I'm going to click inside that headline, and I'm just going to call that one aid and then finally for Programs I'm going to call that one programs. There we go! That was easy enough.

So I'm going to Save that and what we've really done is we've assigned an ID attribute. Now if I look at tag selector right now I can see the Dreamweaver is representing this is h2#program. Now up until now we've really been looking at a lot of classes which use a period to represent themselves, but for IDs the Pound symbol is used. So when we're resolving this link we're going to link to the Pound symbol and then whatever the name of the ID attribute is. So I'm going to scroll back up and we're going to start making our links. I'm going to highlight the text Housing right here and then in the Link dialog box I'm just going to link that to # housing, so I don't need to put any specific document in there or any type of path of the document.

All I need to do, since this is on the same page, is just give the ID of the element that I want to navigate to. I'm just going to continue to do this for each one of these guys. For Portfolio Review I'm just going to do #portfolio. For Financial Aid I'm just going to do #aid, and for Programs, you guessed it #programs. Now you've got to remember the pound symbol. If you don't use that of course your link is not going to resolve.

Now we also have these links right here that will take people back to the top of the page. So that's going to use the first ID with that we created which is #top. Now once you've typed one of these in, remember Dreamweaver has a memory of that. So when I highlight the next line of text that I want to link this to, I can just go right at the top, link it to that and I am good to go. I'm just going to continue to do this for each one of these. So it really doesn't take a lot of time, you can knock these out pretty quickly once you get started on them. So now I'm going to Save this and preview this in my browser.

So now we've set our links at the top, and if I click on Portfolio Review you can see that I jump down to Portfolio. Clicking the Back button will take me back at the top of the page. Now there's one I wanted to list. If I click on Programs for example you'll notice program doesn't quite make it all the way up to the top. And that's basically because there's no room left at the bottom of the page. So as it gets closer to the bottom it's going to stop when it runs out of content down here. Now it is also possible to link to named anchors on separate pages. If I go back into Dreamweaver I can switch over to the Programs page. Now the Programs page is found in the Programs directory whereas the FAQ page is found in the Admissions directory.

Well, if I scroll down I can see that right here I have Please contact the department chair(s) for more information, or view our FAQ on programs. So obviously the only part people here might be interested in is just the section on Programs. So if I highlight this text; I'm going to show you a cool little feature in Dreamweaver. Now obviously I could type in this link and resolve it, but if you aren't just sort of insure exactly what the path is going to be, because we're going upper directory in and down into another directory and if you're kind of unsure how to type that notice that we can go up to the top; I've got both of these documents open at the exact same time, I can go up to the menu and I can go to Window, and I can choose Tile Horizontally or Tile Vertically and what that's going to do is it's going to take the pages that I have open and it's going to put them side by side.

So in this case I'm saying Tile Vertically. Well, what I can do now is I can just sort of scroll to the element on the page that I want to link to. So now I can highlight this FAQ, and I can use the Point of File icon to point to this element on the page. Check out what's being done in the Link dialog box right now. It's resolving this link as ../ meaning go up a folder, admissions go into the Admissions folder, faq.htm and with no spaces #programs. So that's how we resolve name anchor links that are found on other pages.

We just resolve the link as we would normally and then we place the ID right on the end of it. I'm going to let go of that now. I'm going to do a Save All and now if I test my Programs page in the browser, I notice if I scroll down and click on the FAQ, not only does it take me to the Frequently Asked Question page it takes me to that specific region on the page that I was looking for. Now obviously not every page is going to need named anchors. However, when your data requires a lot of scrolling or if you just like to give people quick access to specific locations, named anchors allow you to add a lot of functionality to your sites.

Show transcript

This video is part of

Image for Dreamweaver CS6 Essential Training
Dreamweaver CS6 Essential Training

90 video lessons · 52973 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 1m 4s
    1. What is Dreamweaver?
      1m 4s
  2. 5m 44s
    1. Welcome
      1m 4s
    2. Using the exercise files
      2m 17s
    3. Learning web design
      2m 23s
  3. 1h 0m
    1. Looking at the Welcome screen
      5m 9s
    2. Exploring Windows and Mac interface differences
      5m 6s
    3. Arranging panels
      8m 44s
    4. Managing workspaces
      10m 14s
    5. Exploring the Application toolbar
      6m 21s
    6. Exploring the Document toolbar
      8m 47s
    7. Working with the Property inspector
      9m 30s
    8. Using the Insert panel
      6m 30s
  4. 53m 3s
    1. Understanding basic site structure
      3m 46s
    2. Exploring file naming conventions
      2m 10s
    3. Defining a new site
      5m 23s
    4. Managing files and folders
      7m 57s
    5. Adding remote servers
      7m 4s
    6. Uploading files
      12m 46s
    7. Previewing in browsers
      9m 11s
    8. Managing multiple sites
      4m 46s
  5. 36m 41s
    1. Creating new documents
      6m 49s
    2. Setting up new document preferences
      5m 30s
    3. Setting accessibility preferences
      6m 49s
    4. Working with starter pages
      4m 32s
    5. Managing starter pages
      13m 1s
  6. 37m 23s
    1. Getting text into Dreamweaver
      8m 43s
    2. Importing Word documents
      4m 6s
    3. Adding structure to text
      7m 35s
    4. Creating lists
      4m 35s
    5. Creating definition lists
      4m 0s
    6. Using the Quick Tag Editor
      8m 24s
  7. 44m 41s
    1. Exploring the Code toolbar
      5m 41s
    2. Setting code preferences
      7m 19s
    3. Using code hints
      8m 8s
    4. Wrapping tags
      5m 7s
    5. Adding comments
      6m 29s
    6. Using snippets
      7m 32s
    7. Formatting source code
      4m 25s
  8. 1h 19m
    1. Setting CSS preferences
      9m 32s
    2. An overview of the CSS Styles panel
      9m 23s
    3. Creating a new CSS rule
      6m 42s
    4. Using the CSS Rule Definition dialog
      7m 25s
    5. Organizing styles
      7m 22s
    6. Modifying style properties
      6m 17s
    7. Controlling CSS through the Property inspector
      6m 37s
    8. Attaching external style sheets
      5m 54s
    9. Using CSS visual aids
      7m 3s
    10. Using CSS Inspect
      6m 48s
    11. Using the Code Navigator
      6m 39s
  9. 1h 11m
    1. Managing assets in Dreamweaver
      7m 30s
    2. Setting external image editing preferences
      4m 26s
    3. Placing images on the page
      10m 12s
    4. Exploring Photoshop integration
      7m 17s
    5. Modifying Smart Objects
      9m 42s
    6. Modifying image properties
      8m 4s
    7. Styling images with CSS
      6m 45s
    8. Using background graphics
      7m 28s
    9. Positioning background graphics
      10m 10s
  10. 36m 23s
    1. Link basics
      3m 17s
    2. Setting site linking preferences
      2m 19s
    3. Creating links in Dreamweaver
      9m 17s
    4. Using absolute links
      3m 43s
    5. Using named anchors
      6m 41s
    6. Creating an email link
      5m 25s
    7. Creating CSS-based rollovers
      5m 41s
  11. 44m 30s
    1. Reviewing table structure
      5m 20s
    2. Importing tabular data
      6m 46s
    3. Creating accessible tables
      6m 11s
    4. Exploring basic table styling
      9m 42s
    5. Styling alternate rows
      8m 57s
    6. Creating custom table borders
      7m 34s
  12. 59m 15s
    1. Understanding how forms work
      2m 45s
    2. Reviewing form design
      3m 44s
    3. Creating accessible forms
      5m 16s
    4. Setting form properties
      2m 39s
    5. Using the fieldset and legend tags
      2m 52s
    6. Inserting text fields
      6m 56s
    7. Inserting list menu items
      7m 54s
    8. Inserting checkboxes
      4m 14s
    9. Inserting radio button groups
      3m 52s
    10. Inserting submit buttons
      2m 25s
    11. Exploring basic form styling
      8m 2s
    12. Exploring form element styling
      8m 36s
  13. 33m 25s
    1. Adding CSS3 transitions
      8m 29s
    2. Spry overview
      2m 44s
    3. Using Spry widgets
      3m 57s
    4. Adding Spry effects
      8m 1s
    5. Using the Widget Browser
      7m 4s
    6. Extending Dreamweaver
      3m 10s
  14. 1m 2s
    1. Additional resources
      1m 2s

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

Are you sure you want to delete this note?

No

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.