nesting tags

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
Post Reply
hazelpat
Rank 0 - Newcomer
Posts: 1
Joined: Sat Apr 04, 2009 2:22 pm

nesting tags

Post by hazelpat »

Hi

I am optimising pages with WebPosition and it does not recognise text in <h4> tags which has font tags and A tags like this :-



<H4><a href="http://www.privatetoursuk.com"><font face="georgia" size="2" >british royal family tours </font></a></H4>



So I altered the position of the <H4> tags to either side of the text like this :-



<a href="http://www.privatetoursuk.com"><font face="georgia" size="2" ><H4>british royal family tours</H4></font></a>



Web Position now accepts this, but the HTML validator says that the <h4> tags should not be inside the A tags and font tags.



Please can you tell me how to write this code correctly. ie where should <H4> tags go ?

Regards Hazel
User avatar
CaryD
Rank II - Novice
Posts: 46
Joined: Sun Oct 01, 2006 2:18 pm
Location: CA

Post by CaryD »

See if WebPosition works with this:

<h4><a href="http://www.privatetoursuk.com">british royal family tours</a></h4>

That's the way it should be coded, and if WebPosition can work with that then you'll know the font tags are the problem. You will then need to use CSS instead of the font tags if you want the code to both work with WebPosition and validate.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

I would try what CaryD suggests. I am not familiar with WebPosition, but if it is not wanting you to write good HTML, then I wouldn't use it. :D

You could use something like that as well (I added the CSS to what CaryD suggested):

Code: Select all

<h4 style="font-family:georgia,sans-serif"><a href="http://www.privatetoursuk.com">british royal family tours</a></h4>
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

In case anyone is interested, hazelpat told me that it was the "font" tag that was the problem.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
CaryD
Rank II - Novice
Posts: 46
Joined: Sun Oct 01, 2006 2:18 pm
Location: CA

Post by CaryD »

Albert Wiersch wrote:In case anyone is interested, hazelpat told me that it was the "font" tag that was the problem.
Thank you.
worrall
Rank 0 - Newcomer
Posts: 6
Joined: Sat Aug 25, 2012 8:06 am

Re: nesting tags

Post by worrall »

As you are saying that web position is not accepting the line "<H4><a href="http://www.privatetoursuk.com"><font face="georgia" size="2" >british royal family tours </font></a></H4>",but this is the general format and it is correct format to write the code you are not supposed to write the<h4> tag in midst of the link as it gives the error message while validation, so i would like to suggest you to use css which gives better comfort.
Post Reply