Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts

    Exclamation Show me the way to go Home!

    In the light of the Validator's remarks below, how should I code the return to my index page?

    effpeetee

    The "a" element is not allowed here. In a strict XHTML 1.0 document, the "a" element must be contained in an appropriate container, like a block or inline element. Examples of block elements are "p", "h1", "h2", "div", "ol", "ul", and "table". Examples of inline elements are "a", "b", "i", "strong", "em", and "span".

    Code:
    <body>
    <a href="index.html">Home.</a><br />
     <table align="center" cellspacing="10" cellpadding="15">

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    Just like the validator says - it has to be in a block level element eg.

    Code:
    <body>
    <p><a href="index.html">Home.</a></p>
     <table align="center" cellspacing="10" cellpadding="15">
    Though you might want to look into semantic coding - validation alone is worthless - it doesnt mean your site is good or well coded.

  • #3
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Quote Originally Posted by NancyJ View Post
    Just like the validator says - it has to be in a block level element eg.

    Code:
    <body>
    <p><a href="index.html">Home.</a></p>
     <table align="center" cellspacing="10" cellpadding="15">
    Though you might want to look into semantic coding - validation alone is worthless - it doesnt mean your site is good or well coded.
    Thank you.

    <h5><a href="index.html">Home page.</a></h5> - This doesn't work

    a href="index.html"><h5><Home page.</a></h5> - This does.

    http://www.exitfegs.co.uk/hol1.html


    VIPStephan has already suggested that I look into semantic coding. At present, I am an 82 year old trying to come to terms with XHTML and CSS.

    My site has been largely cobbled together - often cribbed from the Web.

    It works. But I am going to get it sorted out before I go to that great coding house in the sky!!

    I am not sure where semantics take precedence over validation though.

    effpeetee

    Many thanks to you all for your help. Already the main pages are getting better, and I am being to see the trees in the forest.
    Last edited by effpeetee; 05-17-2007 at 10:50 AM.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,777
    Thanks
    6
    Thanked 1,021 Times in 994 Posts
    Quote Originally Posted by effpeetee View Post
    <h5><a href="index.html">Home page.</a></h5> - This doesn't work

    a href="index.html"><h5><Home page.</a></h5> - This does.
    Nah, this can’t be right…
    Semantic code means you choose elements after their meaning and you structure your markup logically. A clean structure would be to divide your page into different sections: header, content, footer (optional), using division elements - and all those three main sections are wrapped by a big container. Like that:

    Code:
    <div id="container">
      <div id="header"></div>
      <div id="content"></div>
      <div id="footer"></div>
    </div>
    If your have a big wrapper/container element that means you can't get such errors as the one you posted above because every element you put inside that container is already within a block level element (the container div).
    So, putting a general wrapper/container div around your content (inside the body) will make this error go away already for a first step.

    Next: Again, this link isn’t a headline, is it? And if it is it can’t be a h4 just by itself because according to the document structure you would need h1 through h3 before you can put an h4 element.
    Choosing an element by the look it generates, e.g. choosing a headline element just because it makes text look bold is the least semantic and the worst approach.

    Don’t get confused by the way something looks because you can always change the look with CSS. You could even make a <strong> element (which makes text look bold too) look thin and oblique with CSS but the function it has would stay the same, i.e. a screen reader would still accentuate that text (speak it louder, with more emphasis).

    A short rule of thumb is: Structure your document logically and choose elements, and class and ID names after their function, not their intended look. The look can always be changed with CSS.

  • #5
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Quote Originally Posted by VIPStephan View Post
    Nah, this can’t be right…
    Semantic code means you choose elements after their meaning and you structure your markup logically. A clean structure would be to divide your page into different sections: header, content, footer (optional), using division elements - and all those three main sections are wrapped by a big container. Like that:

    Code:
    <div id="container">
      <div id="header"></div>
      <div id="content"></div>
      <div id="footer"></div>
    </div>
    If your have a big wrapper/container element that means you can't get such errors as the one you posted above because every element you put inside that container is already within a block level element (the container div).
    So, putting a general wrapper/container div around your content (inside the body) will make this error go away already for a first step.

    Next: Again, this link isn’t a headline, is it? And if it is it can’t be a h4 just by itself because according to the document structure you would need h1 through h3 before you can put an h4 element.
    Choosing an element by the look it generates, e.g. choosing a headline element just because it makes text look bold is the least semantic and the worst approach.

    Don’t get confused by the way something looks because you can always change the look with CSS. You could even make a <strong> element (which makes text look bold too) look thin and oblique with CSS but the function it has would stay the same, i.e. a screen reader would still accentuate that text (speak it louder, with more emphasis).

    A short rule of thumb is: Structure your document logically and choose elements, and class and ID names after their function, not their intended look. The look can always be changed with CSS.
    Hello VIPStephan,
    Firstly, I have added the code that you sent me, to "include.js" .
    IE7 and Opera like it but Firefox does not. It is up on my site now,

    www.exitfegs.co.uk

    Thank you for your help above. I can see what you mean.

    The trouble is that I have learned HTML from the top downwards instead of from the bottom upwards, and I am paying the price for my bad choice.

    However, I am trying to put matters right and I thank you all for your patience. It is a steep climb but quite enjoyable. I just hope that I do not become a bore.

    effpeetee

    You can see me here!! http://www.exitfegs.co.uk/dadatpub.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •