[bcab] Re: html coding


On 30 Jan 2009, at 08:25, Colin Fowler wrote:

Hi,
Thanks to everyone for the previous help on this subject.

I've another question now, how would I code a link to another page so that it lands exactly on the content within that page that I want to direct it to?


Hi Colin,

You have to use an id to identify the content you want to jump to, and then link to it using an absolute URL plus a fragment identifier)

So in the page you want to link to (say it has a URL of http://www.foodtips.com/fastfood.html) , you'd have something like the following:

<p id="cheeseburgers">This is some content about cheeseburgers.</p>

and then have the following link in the document you want to link to it from:

<p>See elsewhere on the site for <a href="http://www.foodtips.com/fastfood.html/#cheeseburgers ">More information about cheese burgers</a>.</p>

you can use the id attribute on most HTML elements; you could link to exact section from the page just by using the fragment identifier on its own, for example <a href="#cheeseburgers">More information about cheese burgers</a>

More information about links is available at 
http://dev.opera.com/articles/view/18-html-links-let-s-build-a-web/
To find out more about BCAB and the benefits that membership can bring, please 
visit our website:
http://www.bcab.org.uk/

To manage your subscription to the BCAB mailing list, please visit our website:
http://www.bcab.org.uk/mailing-list.html

To discuss matters relating to the mailing list, please email 
bcab-moderators@xxxxxxxxxxxxx

Other related posts: