homepage Welcome to WebmasterWorld Guest from 54.196.63.93
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Validation
The validator doesn't like some of my anchor links
Adam5000

5+ Year Member



 
Msg#: 4677436 posted 2:00 pm on Jun 4, 2014 (gmt 0)

I'm starting to validate my pages, and the validator isn't liking some of my anchor links. It mentions something about block-level and inline elements, and I'm not sure what those are. Would someone explain what block-level and inline elements are.


Below is an example.

<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<a class="e" href="../020_e_1/010_shelter.htm">
Text here
</a>

And I'm getting the error message:

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

 

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4677436 posted 5:29 pm on Jun 4, 2014 (gmt 0)

You've left out crucial information. Obviously your anchor doesn't come immediately after the DTD! So we can only assume that the anchor does, in fact, come inside some other element, as suggested by the error message.

Conversely, html4 doesn't like anchors outside block-level elements (like enclosing an entire div) though html5 is OK with it.

Many, many validation errors happen because you forgot to close one element. On a good day, hundreds or even thousands of errors can disappear in one fell swoop if you just find your lone unclosed <h4> or whatever it was.

Adam5000

5+ Year Member



 
Msg#: 4677436 posted 9:20 pm on Jun 4, 2014 (gmt 0)

Strict doctype Lu.

<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4677436 posted 9:34 pm on Jun 4, 2014 (gmt 0)

you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>"


<a class="e" href="../020_e_1/010_shelter.htm">
Text here
</a>

does the "Text here" part contain block-level elements?

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4677436 posted 10:29 pm on Jun 4, 2014 (gmt 0)

Strict doctype

The question is, what comes between the doctype and the anchor? The quoted example only says "there exists at least one anchor" * which does not get us far :(


* Vague mental association with joke about mathematician vs. physicist.

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4677436 posted 10:48 pm on Jun 4, 2014 (gmt 0)

It mentions something about block-level and inline elements, and I'm not sure what those are.

sorry - i missed this.

Block-level and inline elements:
http://www.w3.org/TR/html401/struct/global.html#h-7.5.3

htmlbasictutor



 
Msg#: 4677436 posted 3:17 pm on Jun 17, 2014 (gmt 0)

Try

<p><a class="e" href="../020_e_1/010_shelter.htm">Text here</a></p>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved