How do I add a class to HTML bookmarks generated by core? I'd like to add a CSS class to HTML bookmarks generated by core. Examples of these bookmarks include:

&lt;a id="new"&gt;&lt;/a&gt;

&lt;a id="comment-766013"&gt;&lt;/a&gt;


I'd like to turn them into:

&lt;a id="new" class="bookmark"&gt;&lt;/a&gt;

&lt;a id="comment-766013" class="bookmark"&gt;&lt;/a&gt;


I'm unable to alter these in comment.tpl.php and it looks like theme_comment_view is unavailable in D7, so I'm kind of lost.

Background: I have a sticky header menu that's 60px tall and as such, HTML bookmarks are landing about 60px lower on the page than they should. An example of this is when you link to comment by ID, like http://site.com/article#comment-766013.

Thanks!
Those anchors are added in comment_view(). To override them you'll need to implement hook_comment_view_alter() and reproduce a bit of the logic from the original view function:

function MYMODULE_comment_view_alter(&amp;$build) {
  $comment = $build['#comment'];
  $node = $build['#node'];

  if (empty($comment-&gt;in_preview)) {
    $prefix = '';
    $is_threaded = isset($comment-&gt;divs) &amp;&amp; variable_get('comment_default_mode_' . $node-&gt;type, COMMENT_MODE_THREADED) == COMMENT_MODE_THREADED;

    // Add 'new' anchor if needed.
    if (!empty($comment-&gt;first_new)) {
      $prefix .= "&lt;a id=\"new\" class=\"bookmark\"&gt;&lt;/a&gt;\n";
    }

    // Add indentation div or close open divs as needed.
    if ($is_threaded) {
      $prefix .= $comment-&gt;divs &lt;= 0 ? str_repeat('&lt;/div&gt;', abs($comment-&gt;divs)) : "\n" . '&lt;div class="indented"&gt;';
    }

    // Add anchor for each comment.
    $prefix .= "&lt;a id=\"comment-$comment-&gt;cid\" class=\"bookmark\"&gt;&lt;/a&gt;\n";
    $build['#prefix'] = $prefix;
  }
}