links to other areas within a webpage |
![]() ![]() |
links to other areas within a webpage |
Jan 10 2009, 08:00 PM
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() Group: Member Posts: 86 Joined: Jul 2005 Member No: 179,570 |
I am wondering what the exact codes are for making a link that leads to a particular area of the same webpage. For example, they're often seen on FAQ's or at the bottom of lengthy pages.
|
|
|
|
Jan 10 2009, 08:25 PM
Post
#2
|
|
![]() Sex, Blood, & RocknRoll ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: People Staff Posts: 5,305 Joined: Nov 2007 Member No: 596,480 |
CODE <a href="#TITLE">TITLE</a> CODE <a name="TITLE"></a> The first code is the actual link, the second code gets placed in the area that you want to be linked too. Replace TITLE with whatever, but they have to be the same word except the one between the ><'s . I am horrible at explaining things, but hope this helped. |
|
|
|
Jan 10 2009, 10:23 PM
Post
#3
|
|
![]() Offline. ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 609 Joined: Mar 2007 Member No: 507,591 |
I think that the author above made a mistake you should replace name with id
You can link to any part of a web page that have an id="ID_NAME" for example you can link to CODE <div id="id_name" > CONTENT HERE </div> By using this link CODE <a href="#id_name" > this is a link </a>
|
|
|
|
Jan 10 2009, 10:27 PM
Post
#4
|
|
![]() /人◕‿‿◕人\ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Member Posts: 8,283 Joined: Dec 2007 Member No: 602,927 |
First one is used more often.
|
|
|
|
Jan 10 2009, 10:29 PM
Post
#5
|
|
![]() Offline. ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 609 Joined: Mar 2007 Member No: 507,591 |
Oo. My bad then.. I never seen it. sorry.
|
|
|
|
Jan 11 2009, 02:08 PM
Post
#6
|
|
![]() Senior Member ![]() ![]() ![]() Group: Member Posts: 86 Joined: Jul 2005 Member No: 179,570 |
Thankies. I had been wondering if I could use tag ID's to do that type of link; saves extra coding time and stuff.
|
|
|
|
Jan 11 2009, 03:01 PM
Post
#7
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 |
First one is used more often. It is, however, falling into disuse; the "id" attribute is more common as it can be used with anchors, CSS, and JavaScript, and doesn't require the use of an <a> tag to be thrown into the markup. It's probably better to use the "id" method nowadays. |
|
|
|
Jan 13 2009, 10:31 PM
Post
#8
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 5,880 Joined: Nov 2007 Member No: 593,382 |
Also when linking on a site make sure to use http://www.website.com/ not website.com
also when you add the www's it makes the page load faster. I wont go into details on that, but it works. |
|
|
|
Jan 17 2009, 12:40 AM
Post
#9
|
|
![]() Senior Member ![]() ![]() ![]() Group: Member Posts: 86 Joined: Jul 2005 Member No: 179,570 |
It is, however, falling into disuse; the "id" attribute is more common as it can be used with anchors, CSS, and JavaScript, and doesn't require the use of an <a> tag to be thrown into the markup. It's probably better to use the "id" method nowadays. I tried to make a link using this format, but it doesn't seem to work. If it helps, I am using the code on a geocities domain. I tried having the link both as a href="#title" and a href="http://domain.com/index.html#title," but neither worked. edit: The link worked when I added the tag as a < p > attribute instead of for the div. The only thing that I could think of is that it conflicted with either the overflow:hidden attribute or the 'class' tag. |
|
|
|
Jan 17 2009, 01:06 AM
Post
#10
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 |
You can use "id" and "class" together. What you want to do is something like this:
CODE <a href="#something">This links to something.</a>
<div id="something"><p>Links to here, in fact.</p></div> |
|
|
|
![]() ![]() |