View Full Version : Firefox anchor issue
01-19-2008, 12:42 AM
Okay, I know the usual way to create an anchor is by using the a element, as in :
<a name="name" href="www.dsfsdf.com">The Anchor</a>
However I want to use an <h2> element as an anchor as it sits in a more convenient place. I'm reading in my CSS book here that you can use id values of elements as anchors. This is working fine in IE6 but doesn't seem to work in Firefox. Anyone run into this before?
01-19-2008, 04:41 AM
If you're referring to element linking, it's quite easy..
Anchor: <a href="#section1">Go to Section 1</a>
Element: <h2 id="section1">Section 1</h2>
Clicking "Go to Section 1" on the page would make the browser scroll to the beginning of the element named "section1". I hope that's what you were referring to. If not, this is probably what your CSS book was referring to when it said "use id values of elements as anchors".
01-19-2008, 07:21 AM
…or, to put all possible combos together:
<p><a href="#excerpt">Jump right to the excerpts</a></p>
<p>some text that's in the way</p>
<h2 id="excerpt"><a href="http://example.com/article1.html">Article One</a></h2>
<p>This is the article excerpt, you can also view the whole thing if you want.</p>
<p><a href="http://example.com/article1.html">Read the whole thing</a></p>
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.