[SOLVED] Where to place the "id=" when using <a href'#" to link to it (HTML5)
-
- Rank IV - Intermediate
- Posts: 170
- Joined: Tue Aug 09, 2005 1:20 pm
- Location: Spokane WA
- Contact:
[SOLVED] Where to place the "id=" when using <a href'#" to link to it (HTML5)
Trying to update my last HTML4.01 transitional document to HTML 5 and have a lot of <a name=" markers throughout the document.
I'm using these in case I want to point someone to that particular spot on the web page.
I get that those should be changed to "id=" which I can do, but where do I put them?
This is the page I'm trying to convert: http://dog-walker.org/trains-modern.htm.
You will see each item has the <a name=". I want them as close to the beginning of the item's description as possible.
Some of the items are contained in tables [more than one pic] so that's not a problem as I can put them in the TABLE tag, but those without a TABLE tag?
thanks
I'm using these in case I want to point someone to that particular spot on the web page.
I get that those should be changed to "id=" which I can do, but where do I put them?
This is the page I'm trying to convert: http://dog-walker.org/trains-modern.htm.
You will see each item has the <a name=". I want them as close to the beginning of the item's description as possible.
Some of the items are contained in tables [more than one pic] so that's not a problem as I can put them in the TABLE tag, but those without a TABLE tag?
thanks
Last edited by paulp575 on Tue Jun 22, 2021 11:56 pm, edited 1 time in total.
paulp575
- Albert Wiersch
- Site Admin
- Posts: 3783
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
Hello Paul,
Instead of:
Simply use:
Just put the "id" attribute on the element you want it to go to.
I hope this helps!
Instead of:
Code: Select all
<a name="KRIS_MODEL_TRAINS_ITEMS"></a>
<span class="TEXT-SIZE-24PT">Kris Model Trains (KMT) Items</span>
Code: Select all
<span id="KRIS_MODEL_TRAINS_ITEMS" class="TEXT-SIZE-24PT">Kris Model Trains (KMT) Items</span>
I hope this helps!
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank IV - Intermediate
- Posts: 170
- Joined: Tue Aug 09, 2005 1:20 pm
- Location: Spokane WA
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
Already replaced those types, but what about where I have no CSS or HTML tag? How do I do that? For example:
Can id= stand alone without ant CSS or HTML tags?
Thanks
Code: Select all
<!-- K-Line Loves New York State Boxcar (K-515709) -->
<a name="K-515709"></a>
K-Line Loves New York Boxcar (K-515709)
<br>
<a href="trains/modern/K-515709.jpg" onclick="NewWindow(this.href,'name','1220','447','yes');return false;">
<img src="trains/modern/K-515709.jpg" alt="K Line Loves New York Boxcar image" title="K Line Loves New York Boxcar" width="600" height="214">
</a>
<br><br>
Thanks
paulp575
- Albert Wiersch
- Site Admin
- Posts: 3783
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
I think the best solution in this case would just be to add an appropriate tag... perhaps something like this:paulp575 wrote: ↑Sun Jun 13, 2021 10:00 pm Already replaced those types, but what about where I have no CSS or HTML tag? How do I do that? For example:
Can id= stand alone without ant CSS or HTML tags?Code: Select all
<!-- K-Line Loves New York State Boxcar (K-515709) --> <a name="K-515709"></a> K-Line Loves New York Boxcar (K-515709) <br> <a href="trains/modern/K-515709.jpg" onclick="NewWindow(this.href,'name','1220','447','yes');return false;"> <img src="trains/modern/K-515709.jpg" alt="K Line Loves New York Boxcar image" title="K Line Loves New York Boxcar" width="600" height="214"> </a> <br><br>
Thanks
Code: Select all
<span id="K-515709">K-Line Loves New York Boxcar (K-515709)</span>
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank IV - Intermediate
- Posts: 170
- Joined: Tue Aug 09, 2005 1:20 pm
- Location: Spokane WA
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
Worked - again thanks!
Unfortunately I'm scrapping updating that page to HTML 5. Way too many changes needed.
I looked for an HTML 4.01 transitional to HTML5 converter, but nothing. I did see plenty of pages that said what needed to be changed.
Unfortunately I'm scrapping updating that page to HTML 5. Way too many changes needed.
I looked for an HTML 4.01 transitional to HTML5 converter, but nothing. I did see plenty of pages that said what needed to be changed.
paulp575
- Albert Wiersch
- Site Admin
- Posts: 3783
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
Great! You're very welcome.
I can certainly understand that.
I am not familiar with any except perhaps HTML Tidy which you could try. I haven't used it for conversion though, or for much else because I have little or no need to use it... but it's there and may be able to help if you want to try.
I would bet that there are a lot of issues that make automatic conversion problematic. If your HTML4 pages work well enough and you don't have time to upgrade them to HTML5 then it's probably best to just leave it as is and just make future pages HTML5.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank IV - Intermediate
- Posts: 170
- Joined: Tue Aug 09, 2005 1:20 pm
- Location: Spokane WA
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
I did convert most of my web pages to HTML 5, but this last page is just too long.
I may attempt some day in the future.
Problem I ran across - and am investigating is using iframe to include the menu on the top of the page and the footer.
I may attempt some day in the future.
Problem I ran across - and am investigating is using iframe to include the menu on the top of the page and the footer.
paulp575
-
- Rank IV - Intermediate
- Posts: 170
- Joined: Tue Aug 09, 2005 1:20 pm
- Location: Spokane WA
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
Decided to slowly work on updating this page to HTML 5, but need help with:
Can the id="(text here)" be used twice in the same line - for example, I have this (they are on two lines):
Can the id="(text here)" be used twice in the same line - for example, I have this (they are on two lines):
Code: Select all
<span id="LIONEL_75TH_ANNIVERSARY_SPECIAL" class="TEXT-BOLD TEXT-SIZE-16PT">Lionel 75th Anniversary Special Set (6-1585)</span>
<span id="6-1585_SPECIFIC_ITEMS"></span>
paulp575
- Albert Wiersch
- Site Admin
- Posts: 3783
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
Hello,
That shouldn't be a problem as long as the ID values are unique (you can't use the same ID twice).
You could also do this:
That shouldn't be a problem as long as the ID values are unique (you can't use the same ID twice).
You could also do this:
Code: Select all
<span id="6-1585_SPECIFIC_ITEMS"><span id="LIONEL_75TH_ANNIVERSARY_SPECIAL" class="TEXT-BOLD TEXT-SIZE-16PT">Lionel 75th Anniversary Special Set (6-1585)</span></span>
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank IV - Intermediate
- Posts: 170
- Joined: Tue Aug 09, 2005 1:20 pm
- Location: Spokane WA
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
Okay - so I can place a span tag inside a span? Great! That will solve several message HTML validator keeps displaying.
paulp575
- Albert Wiersch
- Site Admin
- Posts: 3783
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: Where to place the "id=" when using <a href'#" to link to it (HTML5)
Yep!
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial