• NOW LIVE! Into the Woods--new character species, eerie monsters, and haunting villains to populate the woodlands of your D&D games.

Need Help With Some HTML

For work we are designing a website. I have little to no experience in this sort of thing so I was wondering if someone here might be able to help me.

What I am trying to do is create a link to another page that takes you to a spot part-way down the page. If you don't understand what I'm after click on this link here to a online copy of the SRD.

See how it takes you partway down the page to the section about "taking 10". I tried to simply copy the way it was done there but it doesn't seem to work. Can anyone help me?

Thanks in advance,

Olaf the Stout
 

log in or register to remove this ad

There is two parts to this.

Step one: Give the tag around the part you want to link to an ID.

For instance, if you wanted to link to a section in your document marked up like this:

<P>Blah, blah, blah, blah</P>

You would do this:

<P ID="bookmark">Blah, blah, blah, blah</P>

Note: IDs can't have spaces or special characters (you can pretty much use letters, numbers, and the dash symbol), are case sensitive, and you can't use the same ID more than once on a page.

Step two: You create a link to the page that section is in as follows:

<A HREF="http://example.com/yourpage.htm#bookmark">Link text</A>

Note the # sign and the ID name there. That's the anchor that tells the browser to bounce down to that spot.

You can't link to a section of a page unless that section is marked with an ID, though (or the old depreciated "NAME" attribute for the A tag, which functions the same way for this purpose).

Peace & Luv, Liz
 

Thanks for that Liz. One further question. Looking at the HTML code directly, the page is set out as follows <P>blah, blah, blah this goes on for the entire page</P>

The page seems to be set out using code such as this <br /><br /></span><span>. With that being the case, where would I put the ID=xxx in? In the span section? There is also another code called span style. Here is an example of it:

<span style="font-size: 10pt; font-family: 'Century Gothic'">

Would the ID go in there perhaps? Apologies for my total noobness in this area! :o

Olaf the Stout
 

Technically, yes, you can put an ID on almost any tag in the BODY of a page, so sticking one in a SPAN will work. You could do this:

<span id="bookmark" style="font-size: 10pt; font-family: 'Century Gothic'">

I'm a little dismayed that there's only one P (paragraph) tag, though... not really a good way to structure a page. :> Well, unless there's only one paragraph on the page...

Side recommendation: If you need a good primer on HTML in general, HTML Dog is an awesome site.

Peace & Luv, Liz
 

The style attribute is used for inline CSS. Basically, as a result of using the style attribute, that span was was the same as placing a font and a size tag around the text within that element.

As Liz mentioned, you could place the style tag on practically every tag in the body BUT only certain properties/values effect different tags.
 
Last edited:

In my copy of Visual Page (a pretty old web authoring program), the code is simply

<A NAME="bookmark">

with no closing tag.
 

Jeysie said:
Technically, yes, you can put an ID on almost any tag in the BODY of a page, so sticking one in a SPAN will work. You could do this:

<span id="bookmark" style="font-size: 10pt; font-family: 'Century Gothic'">

I'm a little dismayed that there's only one P (paragraph) tag, though... not really a good way to structure a page. :> Well, unless there's only one paragraph on the page...

Side recommendation: If you need a good primer on HTML in general, HTML Dog is an awesome site.

Peace & Luv, Liz

The program is called Joomla! and it's a free program, hence, it is pretty crappy. Joomla seems to use either <SPAN> or <br /> (I'm not sure which) to break up the writing into paragraphs. I don't know if that's how it should be done as I didn't actually create the page in the first place, I'm just trying to add a heap of anchor links to the various webpages on the site.

Thanks to everyone so far for their help. I'm at home now so I'll give some of the suggestions a try when I return to work on Monday.

Olaf the Stout
 

EricNoah said:
In my copy of Visual Page (a pretty old web authoring program), the code is simply

<A NAME="bookmark">

with no closing tag.

Which is the old-school way of doing it. But that's not valid XHTML.
 

Into the Woods

Remove ads

Top