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

Identifying anchor tags

From: Site Navigation with CSS in Dreamweaver

Video: Identifying anchor tags

Throughout this course, the majority of the focus has been on navigating from page to page within a site, but there is another type of navigation that's frequently employed--internal page navigation. Typically, you will need internal navigation on lengthy pages that require a good deal of scrolling. However, with the rise of cell phone web browsing, scrolling is very much upon us. The typical solution to handle internal navigation is named anchors. A named anchor consists of two parts: a triggering link and a target. Let me show you in a blank page what that code looks like.

Identifying anchor tags

Throughout this course, the majority of the focus has been on navigating from page to page within a site, but there is another type of navigation that's frequently employed--internal page navigation. Typically, you will need internal navigation on lengthy pages that require a good deal of scrolling. However, with the rise of cell phone web browsing, scrolling is very much upon us. The typical solution to handle internal navigation is named anchors. A named anchor consists of two parts: a triggering link and a target. Let me show you in a blank page what that code looks like.

So if you go to Dreamweaver > Insert > Named Anchor, and let's call this myAnchor, Dreamweaver will put in a nifty little anchor symbol that we see here. And if we go to Code, you can see that it puts in a empty anchor tag with the name myAnchor, and also an ID of myAnchor. Now, that's the first part of a named anchor. The other part would be to create a link in a slightly different place in the document, let's say Go to My Anchor, which you could then select myAnchor and put in the Link with a leading hash sign whatever the name of the anchor is, in this case myAnchor.

So if in Live view I clicked on myAnchor, it will go to the top of the document here wherever the named anchor is. Now, current web design calls for a rethinking of named anchors for several reasons. First, the extra markup that you see here is really unnecessary. You can target links directly to IDs, which conveniently also use a hash mark as an identifier. Browser support for linking to IDs is pretty much universal. The last browser that didn't support it was Netscape Navigator 4.

Second, and this is a biggie, support for the name attribute is being dropped in HTML5, so in this video I am going to show you to code internal navigation in the right way for now and in the future. All right, so let's go over to portfolio.htm, and here you can see on this portfolio page, we have kind of a lengthy page that consists of a number of projects that we worked on. And on top here there is a listing for each of these, so you can quickly navigate to them. I am going to drop out of Live view here and then just go right to the list that you see here.

So the first thing that we'll do is make sure that we have all of the IDs that we need. And I'm going to go into Split view. And the first one goes right to this first section here for the technical communication suite, and I am going to give this an ID in the h2 tag of tcs, and then let's scroll down to the next one, which happens to be Captivate. And for Captivate, we'll do an id of cp, and then the next one is for the Dreamweaver C5 Bible, and let's give that an id of bible.

Now to save time, I have done the last three. Because we've added these IDs, all of the sections now can be targeted individually. If we wanted to create a link on the same page, now we are ready to create those internal links. Let's scroll back up to where we see Adobe Technical Communication Suite, select the text here, and in the Property Inspector put in a hash mark. And if you recall, the heading for that item was tcs. Now let's do Captivate, which would be hash mark cp. And finally, for the Dreamweaver CS 5 Bible, #bible. And as I said, I went ahead and already did it for the next three.

This one is #dw and so forth. All right, let's give it a spin. We'll go to Design view, enter into Live view, and I am going to go ahead and make sure that I have follow links continuously set up. Let's close down my Properties, and I should be able to go to any of these directly just by clicking on the link. So I'll click on Adobe Technical Communication Suite, and that works. I'll scroll back up, and let's try the Dreamweaver CS 5 Bible this time. Yes, that works just as well. And let's go to the one towards the bottom, the MX 2004.

Now the page will only go as far as it can, and that's why this title doesn't go all the way up to the bottom, because the page does not extend any further. Now granted, scrolling back up every time is a bit of a drag, so the solution most designers opt for is to include another internal link that takes you back to the top of the page. Let's follow that route. Let's go into Split view, and at the end of the Technical Communication Suite, I am going to put in another paragraph tag and give this is class of top link so I can style it later. And this will consist of a anchor tag with an href of #header and I'll close off that tag, put in the content of top and then close the anchor tag.

Now instead of inserting a named anchor, we'll take advantage of an existing header div and link to that--with the leading hash mark of course. So let's see how that looks. That's fine. That's showing up there. I am going to go ahead and copy that, and let's place it after each of these elements here. So after the end of the Captivate one, I will paste that in. At the end of the Bible quote, I'll paste that in, and let's go ahead and do it for the remaining three here, two, and then the final one is here.

So now I should have little top links there. Notice they are kind of inconsistently placed along. So let's add in a little CSS rule in order to move them over to the right, and we'll also kind of shrink them down a little bit. So I'll open up my CSS Styles panel and create a new rule. You can see that the selectors are quite large here. I am going to go ahead and reduce that somewhat. I need a number of these items in order to maintain the specificity, but I don't need quite that many.

So here we have outerWrapper content, and we're going to go ahead and throw in a p tag here. So this will address the toppling classes that are found within paragraphs that are within the content class and also within the otherWrapper. Click OK and let's change the font size to 12, which is a little bit smaller than my text, switch to the Block category and let's align that over on the right. Okay, let's see how that works. Now, I have a top link consistently over on the right.

That looks pretty good. Let's give it a try. Let's go to the CS5 Bible and then click top, and it comes back up to the header div, which is the top of my page. So the one downside I've found of using this technique rather than inserting a Dreamweaver named anchor is that it doesn't allow Dreamweaver to display that wonderful little ship anchor for the name anchor in visible elements in Design view. On the other hand, it's far better coding all around.

Show transcript

This video is part of

Image for Site Navigation with CSS in Dreamweaver
Site Navigation with CSS in Dreamweaver

40 video lessons · 18418 viewers

Joseph Lowery
Author

 
Expand all | Collapse all
  1. 2m 20s
    1. Welcome
      1m 2s
    2. Using the exercise files
      1m 18s
  2. 9m 26s
    1. Using icons in navigation
      2m 14s
    2. Understanding 3D nav bars
      2m 25s
    3. Understanding explanatory navigation
      1m 51s
    4. Creating animated navigation
      2m 56s
  3. 1h 14m
    1. Inserting Spry horizontal menus
      7m 4s
    2. Styling Spry menus
      6m 29s
    3. Adding Spry vertical menus
      5m 7s
    4. Styling Spry vertical menus
      10m 53s
    5. Using Spry tabbed navigation
      9m 33s
    6. Styling Spry tabbed menus
      9m 55s
    7. Including Spry accordion panel menus
      5m 32s
    8. Styling Spry accordion menus
      11m 10s
    9. Advanced Spry menu techniques
      8m 32s
  4. 35m 45s
    1. Converting lists to menus
      7m 56s
    2. Working with background images
      5m 47s
    3. Implementing sprites
      5m 53s
    4. Setting up adjustable backgrounds
      9m 4s
    5. Designing accessible navigation
      7m 5s
  5. 30m 34s
    1. Looking at the project
      1m 4s
    2. Building up the basic HTML
      2m 9s
    3. Displaying top-level links horizontally
      8m 12s
    4. Customizing the link states
      4m 29s
    5. Adding drop-down menus (HTML)
      3m 48s
    6. Working with submenus (CSS)
      4m 8s
    7. Achieving interactive submenus
      2m 21s
    8. Marking the current page
      4m 23s
  6. 23m 13s
    1. Looking at the project
      57s
    2. Understanding vertical menus
      2m 15s
    3. Defining width for link elements
      4m 43s
    4. Using background graphics with navigation
      5m 45s
    5. Creating pop-out vertical navigation
      6m 29s
    6. Setting link states
      3m 4s
  7. 10m 13s
    1. Identifying anchor tags
      7m 4s
    2. Identifying external links
      3m 9s
  8. 18m 14s
    1. Creating jQuery animated image menus
      7m 45s
    2. Using the HTML5 nav tag
      3m 24s
    3. Exploring CSS3 enhancements
      7m 5s
  9. 28s
    1. Next steps
      28s

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 Site Navigation with CSS in Dreamweaver.

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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

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.