Home
Do you chose efficient anchor names?
  v2.0 Posted at 3/03/2017 8:48 AM by Tiago Araujo
These are the things you should consider when creating an anchor link:
  1. Meaningful- When you use named anchors in a web page, use meaningful names. When you are sending the URL by email it helps indicate what you are talking about, and in addition, list numbers often change. An anchor like "#13" becomes incorrect when the order changes.

  2. Case sensitive- Are "http://www.ssw.com.au/ssw/NETUG/DeveloperLinks.aspx#usergroups" and "http://www.ssw.com.au/ssw/NETUG/DeveloperLinks.aspx#UserGroups" the same? The answer is "no" because they might be not case sensitive when they test in some browsers.

  3. No spacing- When you are defining an anchor name, make sure there are no spaces within the name.
    Bad: <a name="Some Anchor Name">
    Good: <a name="SomeAnchorName">

  4. Don't start with a #- When you are defining an anchor name you DO NOT use a #.
    When you are referencing an anchor you DO use a #.
    This is a common mistake because the # is used on the "href".
    Bad: <a name="#SomeAnchorName">
    Good: <a name="SomeAnchorName">

We have a program called SSW Code Auditor to check for #3 and #​4 on this rule.


Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:

    Comments:

    Note: Social Media login for Yotpo is not working in IE or Safari, please use Chrome. We are waiting for Yotpo to fix it.